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

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

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

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

2 comments

0

It didn't work.

0

what was the error

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