for some reason this always runs the elseif unless i have 0 ore. can anyone see my problem?
wait(0.1) function sellclick() local plr = script.Parent.Parent.Parent.Parent.Parent.Parent local item = plr.leaderboard.Ore local money = plr.leaderboard.Money local char = game.Workspace:FindFirstChild(plr.Name) if item.Value >= script.Parent.Amount.Value then item.Value = item.Value - script.Parent.Amount.Value money.MoneyAdd.Value = money.MoneyAdd.Value + script.Parent.Total.Value script.Parent.Parent.Parent.Approved.Visible = true wait(1.5) char.ShopTing.Value = 0 script.Parent.Parent.Parent.Parent:Destroy() else if item.Value < script.Parent.Amount.Value then script.Parent.Parent.Parent.Denied.Visible = true wait(1.5) char.ShopTing.Value = 0 script.Parent.Parent.Parent.Parent:Destroy() end end end script.Parent.Sell.MouseButton1Click:Connect(sellclick)
I think the cause of your problem is that you are using a localscript. Change every script to Normal Scripts and then that will solve your issue. You also need to use Normal Script to Add ores or remove ores from your player.
If you're changing your ore value from properties in studio while in run-time the client knows the value has updated but the server does not (use Test tab ->Current:Client/Server button to see what I mean)
I think you can use remote events or script.Parent.Amount.Changed to tell the script to update its variables :)