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

Why does my tool.Activated only be activated when I hold not click?

Asked by 3 years ago

Why does my tool.Activated only be activated when I hold not click?

I'm trying to make a time slower script but for some reason, I need to hold when using the tool even though I used tool.Activated and Deactivated. Here are the scripts.

Local Script

local tool = script.Parent

tool.Activated:Connect(function()
    game.ReplicatedStorage.TimeSlow:FireServer(true)
end)

tool.Deactivated:Connect(function()
    game.ReplicatedStorage.TimeSlow:FireServer(false)
end)

Server Script

game.ReplicatedStorage.TimeSlow.OnServerEvent:Connect(function(plr, bool)
    if bool == true then
        for i,v in pairs(game.Players:GetPlayers()) do
            script.Slowed:Clone().Parent = v.PlayerGui
            v.Character.Humanoid.WalkSpeed = 1
            workspace.Gravity = 50
        end
    elseif bool == false then
        for i,v in pairs(game.Players:GetPlayers()) do
            v.PlayerGui.Slowed:Destroy()
            v.Character.Humanoid.WalkSpeed = 16
            workspace.Gravity = 196.2
        end
    end
end)

There are no errors but I still need to hold instead of click.

1 answer

Log in to vote
-1
Answered by 3 years ago
Edited 3 years ago

try this:

tool.Activated:Connect(function()
       if bool == true then
             game.ReplicatedStorage.:WaitForChild("TimeSlow"):FireServer(true)

         if bool == false then
                game.ReplicatedStorage.:WaitForChild("TimeSlow"):FireServer(false)
          end
       end
end)

tell me if you have a problem with this ok?

0
that won't work because bool is not a variable in this script, it just came out of nowhere, even if i did put bool it still won't work WINDOWS10XPRO 438 — 3y
Ad

Answer this question