Hello! This one's driving me crazy. I can't simply understand why I get an
attempt to call method 'setPosition' (a nil value)
et the
entity:setPosition(spawnPos)
This two lines
print(entity:GetKeyValue("name"))
print(self.respawnPoint:GetKeyValue("name"))
give me a desired output:
Player name
Spawn point name
Here is the code...
Script.respawnPoint = "" --entity "Respawn point"
function Script:Collision(entity, position, normal, speed)
if (entity:GetKeyValue("name") == "Player") then
spawnPos = self.respawnPoint:GetPosition()
print(entity:GetKeyValue("name"))
print(self.respawnPoint:GetKeyValue("name"))
entity:setPosition(spawnPos)
end
end
It seems to me that in the editor everything is setup correctly: