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

there is an Error on a line for money change gui?

Ok so this is for my admin panel for changing peoples money but it seems to error on a line so I will put a comment on what line!

script.Parent.AdminPanel["Add/Subtract Money"].Submit.MouseButton1Down:connect(function()
	if (script.Parent.Parent.Parent.userId == 10271988 or 22701216 or 85629297 or game.CreatorId) then
		local aplayer = script.Parent.AdminPanel["Add/Subtract Money"].Username.Text
		local player = game.Players:WaitForChild(aplayer)
		local amount = tonumber(script.Parent.AdminPanel["Add/Subtract Money"].Amount.Text)
		if script.Parent.AdminPanel["Add/Subtract Money"].Type.Text == "Add" then
		--this line below has an error
		player.Money.Value = game.Players[player].Money.Value + amount
		end
		if script.Parent.AdminPanel["Add/Subtract Money"].Type.Text == "Subtract" then
			player.Money.Value = game.Players[player].Money.Value - amount
		end
		if script.Parent.AdminPanel["Add/Subtract Money"].Type.Text == "Change" then
			player.Money.Value = amount
		end
	else
		if script.Parent.Notify.Texty.Text == "Text" then
		script.Parent.Notify.Texty.Text = "Access Denied"
		script.Parent.Notify.Visible = true
		script.Parent.Notify:TweenPosition(UDim2.new(0, 0,0, 30),'Out','Quad',0.35)
		wait(0.05)
		script.Parent.Notify:TweenPosition(UDim2.new(0, 0,0, 30),'Out','Quad',0.35)
		script.Parent.Notify.Design:TweenSize(UDim2.new(0.9, 0,0, 2),'Out','Quad',0.35)

		wait(3)
		script.Parent.Visible = false
		script.Parent.Notify:TweenPosition(UDim2.new(0, 0,0, 0),'Out','Quad',0.35)
		script.Parent.Notify.Design:TweenSize(UDim2.new(0, 0,0, 2),'Out','Quad',0.35)
		wait(1)
		script.Parent.Notify.Texty.Text = "Text"

end
		
	end
	
end)

2 comments

0

what does the error sa?

0

Please edit the question and put in what your error is. We cannot help you as easily/quickly if we don't have the error

1 answer

Why are you using "game.Players[player].Money.Value + amount" instead of just player.Money.Value + amount? Makes it way simpler. I made a simple script with my own gui with this and fixed it by doing this.

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