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

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

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

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?

1 comment

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

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