#help with making script only activate when tool is equipped

1 messages · Page 1 of 1 (latest)

lofty harbor
#

i advise using using Tool.Activated for stuff like this

ornate raven
#

check if the tools parent is the player's character

placid pier
ripe gustBOT
#

studio** You are now Level 2! **studio

civic saffron
#

like this?

local player = game.Players.LocalPlayer
local tool = script.Parent
local cilik = player:GetMouse()

local event = game:GetService("ReplicatedStorage"):WaitForChild("FireServer")

local isCooldown = false
local cooldownTime = 8 -- Cooldown time in seconds

tool.Activated:Connect(function()
    if not isCooldown then
        isCooldown = true
        event:FireServer(cilik.Hit.Position)
        task.wait(cooldownTime)
        isCooldown = false
    end
end)