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

How can I stop my spell script from working after a few seconds?

So I'm making a game that involves spells, but I can't figure out how to make it so that after 3 seconds, the click detector won't work unless you say the spell again. How can I do this? Is it possible? I tried a wait(), but it just pauses the whole script.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local test = true
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")

local player = game.Players.LocalPlayer
	local mouse = player:GetMouse()

player.Chatted:connect(function(msg)
	if msg:lower() == "feusur" and  player.TeamColor == BrickColor.new("Mulberry") then
		local number = 1
		mouse.Button1Down:Connect(function()
			if number == 1 then
			if test == true then
			local period = mouse.Hit
			local boo = Vector3.new(0, 0, 90)
			remoteEvent:FireServer(period, boo)
			test = false
			number = 0
			wait(7)
			test = true
				end
		    end
	      end)
	end
end)

1 answer

Have you tried changing the line 20's test to false?

2 comments

0

That just disables it after one use.

0

OOF

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