The random teleport works perfectly, I am just having a hard time with the starter Item.
I want player to go to random place and have this starter gears. I don't want gear in lobby so I did this.
It does work, but sometimes it gives more than 1 set of this item. How do I prevent that?
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
a = math.random(1,4)
if a == 1 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp1.Position.x,workspace.Tp1.Position.y+8,workspace.Tp1.Position.z))
elseif a == 2 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp2.Position.x,workspace.Tp2.Position.y+8,workspace.Tp2.Position.z))
elseif a == 3 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp3.Position.x,workspace.Tp3.Position.y+8,workspace.Tp3.Position.z))
elseif a == 4 then
hit.Parent:MoveTo(Vector3.new(workspace.Tp4.Position.x,workspace.Tp4.Position.y+8,workspace.Tp4.Position.z))
--problem is most likely start here
game.Lighting:findFirstChild("ClassicSword"):clone().Parent = player.Backpack
game.Lighting:findFirstChild("HyperlaserGun"):clone().Parent = player.Backpack
game.Lighting:findFirstChild("Pistol"):clone().Parent = player.Backpack
game.Lighting:findFirstChild("RocketLauncher"):clone().Parent = player.Backpack
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
upvoet bples
ah i wishhhh cuz your answer was flawless