Ok, so I have a remote event going from a GUI local script to a leaderboard script and it wont take the money away. Here are the scripts. This is probably a easy mistake....
local script from GUI
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage:WaitForChild("CreatePartEvent")
createPartEvent:FireServer()
script.Parent.Text = "Spawn"
end
end
end)
leaderboard script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "CreatePartEvent"
local function onCreatePartFired(player)
local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.StarterGui.PurchaseGUI.ScrollingFrame.Jugatti.Name)
game.Players.player.leaderstats.Cash.Value = game.Players.player.leaderstats.Cash.Value - PriceOfItem
script.Parent.StarterGui.PurchaseGUI.ScrollingFrame.Jugatti.Purchased.Value = true
end
createPartEvent.OnServerEvent:Connect(onCreatePartFired)

1 comment
Why are there three random end statements in the local script?