Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I give a player a tool with a TextButton?

Asked by 4 years ago

How do I give a player a tool by clicking a Text/Image button? I can't seem to figure out how and I am a beginner! Thanks!

1 answer

Log in to vote
0
Answered by 4 years ago

place a screengui in the startergui, and then place a localscript and a textbutton in the screengui.

then we need to script a function for when the textbutton gets pressed

script.Parent.TextButton.MouseButton1Click:Connect(function()

end)

where you can use this function so when the textbutton is pressed, it will fire the function

lastly we need to add the tool into the backpack, where we need to put an item of our choice in the replicatedstorage

and then clone the tool into the player's backpack

script.Parent.TextButton.MouseButton1Click:Connect(function()
    local player = script.Parent.Parent.Parent
    local tool = game.ReplicatedStorage.tool:Clone()
    tool.Parent = player.Backpack
end)

this will place the tool of choice into the player's backpack

by the way you dont have to put the tool in the replicated storage, hopefully this helped

0
It didn't work. LinkZelda_Sage 16 — 4y
0
what was the error NeonPandaEyes331 21 — 4y
Ad

Answer this question