I have a script that works in studio, but not in the actual game. What is wrong? It isn't cloning my milk tool into the player's inventory.
local CupTool = game.ServerStorage.Milk script.Parent.Touched:connect(function(hit) if hit.Parent.Name == "Empty Cup" then hit.Parent:Destroy() CupTool:Clone().Parent = game.Players.LocalPlayer.Backpack wait() end end
Is that a local script? If so, local scripts can not access ServerStorage. They can in studio, but not in the full game. You should put the cup tool in ReplicatedStorage instead.
It may because you're using a local script, if it is then I have a few changes:
local CupTool = game.ServerStorage.Milk script.Parent.Touched:connect(function(hit) if hit.Parent.Name == "Empty Cup" then local player = game.Players:GetPlayerFromCharacter(hit.Parent) hit.Parent:Destroy() CupTool:Clone().Parent = player.Backpack end end) -- Forgot your closed bracket.