I have a runebutton that when touched it finds if the object that touched it was a player and if so then start a cooldown and fire a RemoteEvent in ReplicatedStorage player and object
--local script
script.Parent.Touched:Connect(function(object)
local touch = false
if object.Parent:FindFirstChild("Humanoid") then
local player = game.Players[object.Parent.Name]
if touch == true then
repeat
wait(60)
until touch == false
game.ReplicatedStorage.RuneCurse:FireServer(player, object)
touch = true
end
end
end)
This is a script in ServerScriptService and when that remoteevent is fired, check if the player has more than 250 of the currency and if so, take away 250 and do math.random. There is a 50/50 chance the player is cursed and lucky. If the number is 1 then kill the player and fire Broadcast to all clients. If the number is 2 then give the player 500 of the currency and fire to all clients Broadcast
--script
function cursefunction(player, object)
if player:WaitForChild("leaderstats").Quacks.Value >= 250 then
player:WaitForChild("leaderstats").Quacks.Value = player:WaitForChild("leaderstats").Quacks.Value - 250
local curse = math.random(1, 2)
if curse == 1 then
object.Health = 0
local cursechatsend
game.ReplicatedStorage.Broadcast:FireAllClients(cursechatsend)
elseif curse == 2 then
player:WaitForChild("leaderstats").Quacks.Value = player:WaitForChild("leaderstats").Quacks.Value + 500
local luckychatsend
game.ReplicatedStorage.Broadcast:FireAllClients(luckychatsend)
end
end
end
game.ReplicatedStorage.RuneCurse.OnServerEvent:Connect(cursefunction)
This is a localscript in the remotevent Broadcast. If the player was lucky then send a message in chat as follows, otherwise send a different message.
--localscript
function broadcast(luckychatsend, player)
local luckychat = game.StarterGui:SetCore("ChatMakeSystemMessage", {Text = player.."won 500 Quacks for the curse rune!";
Font = Enum.Font.SourceSansBold;
Color = Color3.fromRGB(0,255,255);
FontSize = Enum.FontSize.Size18;
})
end
game.ReplicatedStorage.Broadcast.OnServerEvent:Connect(broadcast)
function broadcastl(cursechatsend, player)
local cursechat = game.StarterGui:SetCore("ChatMakeSystemMessage", {Text = player.."has died from the rune curse!";
Font = Enum.Font.SourceSansBold;
Color = Color3.fromRGB(255,0,0);
FontSize = Enum.FontSize.Size18;
})
end
game.ReplicatedStorage.Broadcast.OnServerEvent:Connect(broadcastl)
The scripts aren't working and there are no errors recorded. I tried printing messages but nothing showed up. What's going wrong?

2 comments
I use touch as a cooldown so the player doesn't constantly touch it
Unfortunately, this doesn't work