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

How can I run a function anytime a player equips a tool?

I made a script that toggles a run for the character. I want the character to be UNABLE to equip tools while running = true. How can I do this?

1 comment

0

how fast would the player be going while running? I am asking so I can make the script.

1 answer

✓ Accepted answer

Well the function for equipping tools is: .Equipped:connect(function() And make sure that you change running from a variable to a bool value so the scripts can communicate. Then, put a local script in the tool and write this.

local p = game.Players.LocalPlayer
local pname = p.Name

function equip(equipped)
	if --Put location of the running bool value here--.Value == true then
		for i, v in pairs(game.Workspace:GetChildren()) do
		if pname == v.Name then
		script.Parent.Parent = p.Backpack
    end
end

script.Parent.Equipped(equip)

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