Dash with tool only

Ok so I made a weapon, and it works. But I want to add dash. I only want to dash with the tool only and not unequipped. How would I make that happen

You could just check if the tool is a descendant of the character to tell if it is equipped.

Example:

if tool:IsDescendantOf(character) then
–can dash
end

From the dash script or from a tool script?

Just have a tool reference and character reference in any script and it should work fine.

1 Like
local State

local function OnEquipped()
	State = true --Is equipped.
end

local function OnUnequipped()
	State = false --Is unequipped.
end

Tool.Equipped:Connect(OnEquipped)
Tool.Unequipped:Connect(OnUnequipped)

State can be a ‘BoolValue’ object if you need the value to be read from multiple scripts.

1 Like