Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

GuiSell thinks i always have 0 Ore, help?

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)

2 answers

✓ Accepted answer

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.

1 comment

0

Thank you! I was not using a local script, but I found another place where I was using one, which fixed it completely!

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 :)

This discussion is preserved as it was. New answers, comments, and votes are closed.