How would I make a ImageButton, or a TextButton be able to give you custom tools, like soda, guns, etc? I have the Gui and image buttons, but I need the script to give the tools.
Well, you'd need to get down some events and the cloning method.
--Local Script plr = game.Players.LocalPlayer tool = game.ServerStorage["Tool name here"] script.Parent.MouseButton1Down:connect(function() tool:clone().Parent = plr.Backpack --tool:clone().Parent = plr.StarterGear end)
Go to replicated storage then create Remote Event. Name the Remote event to ToolGiverEvent or any
Put this local script in gui button:
local ReplicatedStorage = game:GetService("ReplicatedStorage") script.Parent.MouseButton1Click:connect(function() ReplicatedStorage.ToolGiverEvent:FireServer() -- Change the "ToolGiverEvent" to the remote event name end)
Then put this in ServerScriptService:
game.ReplicatedStorage.ToolGiverEvent.OnServerEvent:Connect(function(plr) -- Change the "ToolGiverEvent" to the remote event name game.ServerStorage.ToolName:Clone() -- Change the "ToolName" to the name of the tool game.ServerStorage.ToolName:Clone().Parent = plr.Backpack -- Change the "ToolName" to the name of the tool end)