Hey there, the problem is:
I click the button once and it fires the button code ONCE but the event fires TWICE
Client
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cooldown = false
script.Parent.MouseButton1Up:Connect(function()
print("click")
if not cooldown then
cooldown = true
ReplicatedStorage:FindFirstChild("EquipSword"):FireServer(tostring(script.Parent.Name))
wait(1)
cooldown = false
end
end)
Server
--Equip a sword frm your inventory
EquipSwordRE.OnServerEvent:Connect(function(player, Sword)
print(Sword.." equipped")
if player.Swords:FindFirstChild(Sword) then
if player.Backpack:FindFirstChildOfClass("Tool") then
if player.Backpack:FindFirstChild(Sword) then
player.Backpack:FindFirstChildOfClass("Tool"):Destroy()
player.checks.Equipped.Value = " "
else
player.Backpack:FindFirstChildOfClass("Tool"):Destroy()
ServerStorage.Swords:FindFirstChild(Sword):Clone().Parent = player.Backpack
player.checks.Equipped.Value = Sword
end
elseif workspace:FindFirstChild(player.Name):FindFirstChildOfClass("Tool") then
if workspace:FindFirstChild(player.Name):FindFirstChild(Sword) then
workspace:FindFirstChild(player.Name):FindFirstChildOfClass("Tool"):Destroy()
player.checks.Equipped.Value = " "
else
workspace:FindFirstChild(player.Name):FindFirstChildOfClass("Tool"):Destroy()
ServerStorage.Swords:FindFirstChild(Sword):Clone().Parent = player.Backpack
player.checks.Equipped.Value = Sword
end
else
ServerStorage.Swords:FindFirstChild(Sword):Clone().Parent = player.Backpack
player.checks.Equipped.Value = Sword
end
end
end)
Console print:
click
Sword equipped
Sword equipped
The issue is not in my code, since it worked fine the other day, so it’s most likely caused by a new Roblox update.
I have the same issue with ALL of my remote events.
ALL of them.