Help! When the play clicks x for the second time and the items are brought in they cannot be deselected when selected causing them all to stack onto each other.
wait(1) print("Loaded") local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local character = Player.Character local Tools = Player.Backpack local startgear = Player.StarterGear function makegearstart() for i,v in pairs(Tools:GetChildren()) do v:clone().Parent = startgear end end makegearstart() ------------------------------------------- function speed(speed) character.Humanoid.WalkSpeed = speed -- speed function end function holdingtool() for _, child in pairs(character:GetChildren()) do if child.ClassName == "Tool" then child:remove() end end end function givebacktool() for i,v in pairs(startgear:GetChildren()) do v:clone().Parent = Tools end end Mouse.KeyDown:connect(function(Key) -- main thing if Key == "x" then if character.Humanoid.WalkSpeed > 0 then speed(0) Tools:Remove() holdingtool() else speed(16) givebacktool() end end end)
Do you know how to fix this? Thanks.
Edit: He completely changed the question...
ServerStorage
can only be accessed with server scripts.
You should use ReplicatedStorage
instead as this can be accessed by clients and the server.
The reason this works in Studio is because there isn't a server, therefore the ServerStorage is located on the client instead.
For example instead of:
local Animation = game.ServerStorage.Animation
You should use:
local Animation = game:GetService("ReplicatedStorage").Animation
Also make sure you move the animation into the ReplicatedStorage