game.Workspace.Guns.Changed:connect(function(t) print("Value Changed") if t == "Start" then print("Value = Start") local Player = game:GetService("Players").LocalPlayer local Item = game:GetService("ReplicatedStorage").Pistol:Clone() print("Player defined, item cloned") Item.Parent = Player.Backpack print("Item parented") end end)
This is in a LocalScript and in StarterGui. I neeed it to give the player and gun and if they die and respawn to still give them the gun. After the round has ender, I have a script which removes the gun from the players inventory.
game.Workspace.Guns.Changed:connect(function(t) print("Value Changed") if t == "Start" then print("Value = Start") local Player = game:GetService("Players").LocalPlayer local Item = game:GetService("ReplicatedStorage").Pistol:Clone() print("Player defined, item cloned") Item.Parent = Player.Backpack print("Item parented") Player.CharacterAdded:connect(function() local Item = game:GetService("ReplicatedStorage").Pistol:Clone() print("Item cloned") Item.Parent = Player.Backpack print("Item parented") end) end end)
Perhaps this will work, un-tested.
NOTE: If it doesn't work don't just straight out down-vote the post, explain what happens and give output if possible