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)

2 comments
That just disables it after one use.
OOF