Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this Script does Not Give the Player a Tool?

I'm trying to make a crate system, I did all the things but it doesn't give the player the tool. I'm using the right parents and all of the other things. This is the script:

local SS = game:GetService("ServerStorage")
local Items = {SS.DefaultSword, SS.Sword}
 
script.Parent.MouseButton1Click:connect(function()
	local item = Items[math.random(1, #Items)]
	
	item:Clone().Parent = game.Players.LocalPlayer.Backpack
end)

Thanks, MajinBluee

1 comment

0

You cannot access ServerStorage from a localscript

1 answer

✓ Accepted answer

Hello there. The reason it doesn't work is because you cannot access the ServerStorage in local scripts and cloning will not replicate on local scripts. I highly suggest you use a remote event to fire server when the button is clicked, and let the cloning take place on the server.. I will not be providing scripts as I do not wish to make free stuff for you but I am sure this will help. https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events If this helped, please accept answer and if there are anymore, report any more issues in the comments. Accepting answer gives us both rep and marks the question answered.. Thanks!

2 comments

0

Thanks Bro!

0

Anytime!

This discussion is preserved as it was. New answers, comments, and votes are closed.