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

Why isn't my tool working? (Need this extra part for title)

Asked by
rexpex 45
7 years ago

I'm trying to make a tool that prints "fart" when its equipped and you click.

Player = game.Players.LocalPlayer
Character = Player.Character
Humanoid = Character.Humanoid
Mouse = Player:GetMouse()
local tool = script.Parent

function onEquipped()
Mouse.Button1Down:connect(function()
    print("fart")   

end)
end)
tool.Equipped:connect(onEquipped)

why isn't it working?

0
Make sure your tool has a part named "Handle", or turn off the "RequiresHandle" property. I've had this before. RubenKan 3615 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

Use the tool.Activated event.

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local Mouse = Player:GetMouse()
local tool = script.Parent

tool.Activated:Connect(function()
    print("Fart")
end)
Ad

Answer this question