Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

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

Asked by 7 years ago

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)

0
what does the error sa? jacobwow 140 — 7y
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 lightpower26 399 — 7y

1 answer

Log in to vote
1
Answered by
Robin5D 186
7 years ago
Edited 7 years ago

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.

Ad

Answer this question