Ok so I am making a game that is a mix of snow shoveling simulator and lumber tycoon 2 and there is a feature where you can buy different areas.
How it should work
When the part is touched then if they have enough money the part will destroy locally.
Everything works except after one player buys the area the other person cant buy it. There were no errors.
Local script in starter player scripts
local debounce = false
if debounce == false then debounce = true if hit.Parent:FindFirstChildWhichIsA("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= game.Players.LocalPlayer then return else game.ReplicatedStorage.DestoryBarrier.OrangeTree:FireServer("OrangeBorder", 100) print("Server Fired!") wait(1) debounce = false end end end
Something was weird with the formatting ^^
Script in server script service
game.ReplicatedStorage.DestoryBarrier.OrangeTree.OnServerEvent:Connect(function(player, border, price) print("Recived!") print(player, border, price) print(player.leaderstats.Coins.Value) if player.leaderstats.Coins.Value >= price then player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - price game.ReplicatedStorage.DestoryBarrier.OrangeTree:FireClient(player, border) end
Thank you for reading!