So I'm new to scripting and I'm really looking for a scripting helper because I'm trying to make a button that gives tools. So this is what I found.

local player = game.Players.LocalPlayer local tool = game.ServerStorage.AdventureIsland

script.Parent.MouseButton1Click:connect(function() tool:Clone().Parent = player.Backpack script.Parent.Parent.Parent:Destroy() end)

Does this work? I tried didn't work for me. It would be great if someone helps me.

2 comments

0

Looks like this is a LocalScript. LocalScripts cannot access ServerStorage. You should put the sword in ReplicatedStorage and use RemoteEvents to clone the sword into the player's backpack. Have it fire after the button is clicked.

0

Use a code block and use :Connect as :connect is deprecated.