I was revamping my magic spell GUI but it worked, and I was using RemoteEvent (this is not the problem) then it worked, I pressed 1 and it worked but when I right click or left click my mouse it deactivates, the bad news is I want to keep the spells deactivates when a different number is pressed so the player won't spam all the spells at once. And the really bad thing I hate, you know, deactivates if it is used.
local players = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()
local character = players.Character or players.CharacterAdded:Wait()
local u = game:GetService("UserInputService")
local t = game:GetService("TweenService")
local mouse = players:GetMouse()
local againer = false
local image = script.Parent.Image
local cooldown = false
local mana = script.Parent.Parent.Parent.Frame.Bar.TextLabel.Mana
u.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Two and againer == false then
image.Image = "rbxgameasset://Images/Pain Symbol"
againer = true
else
image.Image = "rbxgameasset://Images/dash"
againer = false
end
end)
script.Parent.MouseButton1Click:Connect(function()
if againer == false then
image.Image = "rbxgameasset://Images/Pain Symbol"
againer = true
else
image.Image = "rbxgameasset://Images/dash"
againer = false
end
end)
mouse.Button1Down:Connect(function()
if againer == true then
if mana.Value >= 100 and cooldown == false then
cooldown = true
script.Parent.Cooldown.Visible = true
script.Parent.Cooldown.Text = "4"
wait(1)
script.Parent.Cooldown.Visible = true
script.Parent.Cooldown.Text = "3"
wait(1)
script.Parent.Cooldown.Visible = true
script.Parent.Cooldown.Text = "2"
wait(1)
script.Parent.Cooldown.Visible = true
script.Parent.Cooldown.Text = "1"
cooldown = false
wait(1)
script.Parent.Cooldown.Visible = false
end
end
end)
script.Parent.MouseEnter:Connect(function()
script.Parent.INFO.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.INFO.Visible = false
end)
If you don't get what I mean, this is the example: Player used a spell and left/right clicked and the spell deactivated, but Player wants the spell be activated almost all the time to spam it. But every clicks = spell deactivates, why?
