You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
when the player clicked the button it equips their tool
What is the issue? Include screenshots / videos if possible!
well i have it sort of working like it shows its been clicked but no tool equips nor unequips
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i’ve been looking for solutions on here and on google
How about you put your script here, since you’re asking for scripting help.
You can also search developer.roblox.com to find out a lot about Roblox stuff. print("...stuff...") statements can be used in your script to pinpoint what’s happening in your Output window.
Also a picture of your Explorer window with the way your button and script are placed, as well as any items that are called for in your script. For example if you have button = script.Parent.Parent.ButtonPart.ClickDetector then is the ClickDetector actually a child of the ButtonPart which is a child of the item the script is in?
I guess you know how to connect those with your Click Event.
If you don’t, the way to do it with a ClickDetector is by using the ClickDetector.MouseClick event
example:
local tool = your tool basically
local detector = your click detector
detector.MouseClick:Connect(function(player)
local humanoid = player.Character.Humanoid
humanoid:EquipTool(tool)
end)
this it what i use for the button, for it to show the button, and for it to equp the tool
local player = game.Players.LocalPlayer
local toolequipped = false
local button = script.Parent
script.Parent.MouseButton1Click:Connect(function()
if toolequipped == false then
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
local tool = player.Backpack.Punch
if tool then
humanoid:EquipTool(tool)
toolequipped = true
button.Image = "rbxassetid://8719690992"
end
end
end
elseif toolequipped == true then
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
local tool = player.Backpack.Punch
if tool then
humanoid:UnequipTools(tool)
toolequipped = false
button.Image = "rbxassetid://8719666363"
end
end
end
end
end)
tool.Parent = player.Backpack or player.Character
--if you want it to go in their backpack or character then delete the other one
---like if you want the tool to be equipped when they get it give it to their character
--but if not then parent it to the player's backpack
local player = game.Players.LocalPlayer
local toolequipped = false
local button = script.Parent
script.Parent.MouseButton1Click:Connect(function()
if toolequipped == false then
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
local tool = player.Backpack.Punch
if tool then
humanoid:EquipTool(tool)
toolequipped = true
button.Image = "rbxassetid://8719690992"
end
end
end
elseif toolequipped == true then
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if player.Character:FindFirstChildOfClass("Tool") then
humanoid:UnequipTools(player.Character:FindFirstChildOfClass("Tool"))
toolequipped = false
button.Image = "rbxassetid://8719666363"
end
end
end
end
end)