The script works in the sense that when you click the GUI that the script is contained it, it teleports you and gives you your weapons of choice. However, if you were to change those weapons, the script wouldn't detect that, and would give you the old weapons instead.
I have no idea why this is happening. Can someone please help me?
Here's the script:
local Player = script.Parent.Parent.Parent.Parent.Parent
local W1 = script.Parent.Parent.Parent:WaitForChild("Wep1")
local W2 = script.Parent.Parent.Parent:WaitForChild("Wep2")
local GamePlaying = game.ServerScriptService.MainGame:WaitForChild("Playing")
local Weapon1 = game.ServerStorage.Weapons[W1.Value]:clone()
local Weapon2 = game.ServerStorage.Weapons[W2.Value]:clone()
function onButtonClicked()
if GamePlaying.Value == true then
local torso = Player.Character.Torso
local spawns = {}
for i,v in ipairs(game.Workspace.Map.Spawns.Team1:GetChildren()) do
if v.Name == "Spawn" then
table.insert(spawns,v)
end
end
Weapon1.Parent = Player.Backpack
Weapon2.Parent = Player.Backpack
torso.CFrame = spawns[math.random(1,#spawns)].CFrame
+ Vector3.new(0,4,0)
script.Parent.Parent.Parent:remove()
end
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

1 comment
Thanks so much!