I made this script so when a specific button i pressed, i gives money.( If need context here it is: a proximity prompt is triggered from an npc. When the Proximity Prompt is triggered, a script in ServerScriptService will Trigger a remote event in Replicated Storage. When the remote event will be triggered, a cash register in workspace will receive the triggered event (a script in the cash register)
When the remote event is received, the script will randomly choose a button on the cash register and will make it become neon.
So right now im at the part where im making the script that gives you money when the player presses the neon button. I finished righting the script, there aren’t any mistakes in it (no errors appear). but when i test it, nothing happens, and i still get no errors in the output. if you now a fix, pls tell me.
heres the code
local Workspace = game:GetService("Workspace")
local OrderBloxyColaEvent = ReplicatedStorage:WaitForChild("OrderBloxyCola")
local OrderPizzaEvent = ReplicatedStorage:WaitForChild("OrderPizza")
local OrderBurgerEvent = ReplicatedStorage:WaitForChild("OrderBurger")
local OrderFriesEvent = ReplicatedStorage:WaitForChild("OrderFries")
local OrderTacoEvent= ReplicatedStorage:WaitForChild("OrderTaco")
-------------------------------------------------------------------------
local BloxyColaButton = Workspace.CashRegister1.BloxyColaButton
local BurgerButton = Workspace.CashRegister1.BurgerButton
local FriesButton = Workspace.CashRegister1.FriesButton
local PizzaButton = Workspace.CashRegister1.PizzaButton
local TacoButton = Workspace.CashRegister1.TacoButton
-------------------------------------------------------------------------
local BloxyColaImageButton = Workspace.CashRegister1.BloxyColaButton.SurfaceGui.BloxyCola
local BurgerImageButton = Workspace.CashRegister1.BurgerButton.SurfaceGui.Burger
local PizzaImageButton = Workspace.CashRegister1.PizzaButton.SurfaceGui.Pizza
local TacoImageButton = Workspace.CashRegister1.TacoButton.SurfaceGui.Taco
local FriesImageButton = Workspace.CashRegister1.FriesButton.SurfaceGui.Fries
-------------------------------------------------------------------------
local Player = game.Players.LocalPlayer
local Money = Player:WaitForChild('leaderstats'):WaitForChild('Money')
-------------------------------------------------------------------------
OrderBloxyColaEvent.OnClientEvent:Connect(function(PlayerWhoClicked)
function OnClicked1(PlayerWhoClicked)
Money.Value = Money.Value + 3
Workspace.Customer1.Torso.ProximityPrompt.Enabled = true
BloxyColaButton.Material = ("Plastic")
end
end)
OrderTacoEvent.OnClientEvent:Connect(function(PlayerWhoClicked)
function OnClicked2(PlayerWhoClicked)
Money.Value = Money.Value + 3
Workspace.Customer1.Torso.ProximityPrompt.Enabled = true
TacoButton.Material = ("Plastic")
end
end)
OrderFriesEvent.OnClientEvent:Connect(function(PlayerWhoClicked)
function OnClicked3(PlayerWhoClicked)
Money.Value = Money.Value + 3
Workspace.Customer1.Torso.ProximityPrompt.Enabled = true
FriesButton.Material = ("Plastic")
end
end)
OrderBurgerEvent.OnClientEvent:Connect(function(PlayerWhoClicked)
function OnClicked4(PlayerWhoClicked)
Money.Value = Money.Value + 3
Workspace.Customer1.Torso.ProximityPrompt.Enabled = true
BurgerButton.Material = ("Plastic")
end
end)
OrderPizzaEvent.OnClientEvent:Connect(function(PlayerWhoClicked)
function OnClicked5(PlayerWhoClicked)
Money.Value = Money.Value + 3
Workspace.Customer1.Torso.ProximityPrompt.Enabled = true
PizzaButton.Material = ("Plastic")
end
end)
BloxyColaButton.ClickDetector.MouseClick:Connect(OnClicked1)
TacoButton.ClickDetector.MouseClick:Connect(OnClicked2)
FriesButton.ClickDetector.MouseClick:Connect(OnClicked3)
BurgerButton.ClickDetector.MouseClick:Connect(OnClicked4)
PizzaButton.ClickDetector.MouseClick:Connect(OnClicked5) ```