HungryBerryBush Posted March 12, 2015 Share Posted March 12, 2015 Hello!I been trying to get a teleport function to work, though I seem to have hit a problem.It keeps saying randomteleport is a nil value. This is the part having trouble in the modmain.if GetPlayer() and GetPlayer().prefab == "esctemplate" then GetPlayer().randomteleport(GetPlayer())endAnd this is the function in the character's lua.local function randomteleport(inst) local x2, y2, z2 = inst.Transform:GetWorldPosition() local x, y, z = inst.Transform:GetWorldPosition() x = x+math.random(-20, 20) z = z+math.random(-20, 20) inst.Transform:SetPosition(x,y,z) if not inst:IsOnValidGround() then inst.Transform:SetPosition(x2,y2,z2) randomteleport(inst) endendDoes anyone by any chance know what the problem is? Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.