Hello! I’m working on a game and some reason the remote event isn’t working. I’m probably just tired, but yeah.
Script To Fire:
script.Parent.Button.ClickDetector.MouseClick:Connect(function(player)
if player.leaderstats.Credits.Value >= 2 then
game.ReplicatedStorage.Games.CoinChoose.Started:FireClient(player)
script.Parent.Button.SurfaceGui.TextLabel.Text = "Playing: " .. player.Name
script.Parent.Button.BrickColor = BrickColor.Blue()
script.Parent.Button.ClickDetector.MaxActivationDistance = 0
else
script.Parent.Button.SurfaceGui.TextLabel.Text = "Not Enough Credits"
wait(2)
script.Parent.Button.SurfaceGui.TextLabel.Text = "2 Credits"
end
end)
Server Script With Event:
local coins = {"🔴", "🔵"}
local displayRandomCoins = math.random(1, #coins)
local pickCoin = math.random(1, #coins)
local function main()
game.Workspace.CoinChooser.Mechanics.Texts.Instructions.SurfaceGui.TextLabel.Text = "Picking Coin..."
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Mechanics.Texts.ResultDisplay.SurfaceGui.TextLabel.Text = displayRandomCoins
wait(0.5)
game.Workspace.CoinChooser.Values.Result.Value = pickCoin
end
game.ReplicatedStorage.Games.CoinChoose.Started.OnServerEvent:Connect(function(player)
game.Workspace.CoinChooser.Mechanics.Texts.Instructions.SurfaceGui.TextLabel.Text = "Pick a coin!"
end)
game.ReplicatedStorage.Games.CoinChoose.CoinChosen.OnServerEvent:Connect(function(player)
main()
wait(3)
if game.Workspace.CoinChooser.Values.Result.Value == script.Parent.Parent.Values.Pick.Value then
game.Workspace.CoinChooser.Mechanics.Texts.Instructions.SurfaceGui.TextLabel.Text = "You won 25 tickets!"
player.leaderstats.Tickets.Value = player.leaderstats.Tickets.Value +25
else
game.Workspace.CoinChooser.Mechanics.Texts.Instructions.SurfaceGui.TextLabel.Text = "You lost! Try again!"
end
end)