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

script is having error "bad argument #2 to '?' (UDim expected, got number)"?

Asked by 8 years ago
if game.Workspace.Remote.OnServerEvent then
    Notification = script.Parent.Notification:Clone()
    Notification.Parent = script.Parent.Parent
    if script.Parent.Queue.Value >0 then
        Notification.Position.Y = Notification.Position.Y + (-105*script.Parent.Queue.Value)
    end
    Notification:TweenPosition(UDim2.new(0,0,0, (-105*script.Parent.Queue.Value)), "Out", "Sine", 1, false)
    wait(1)
    script.Parent.Queue.Value = script.Parent.Queue.Value + 1
end

When i try to fire the server event it'll print this http://imgur.com/oe66i7S

1 answer

Log in to vote
0
Answered by 8 years ago

If Notification is a Gui Object, then it's Size and Position are set by UDim2.new()

if game.Workspace.Remote.OnServerEvent then
    Notification = script.Parent.Notification:Clone()
    Notification.Parent = script.Parent.Parent
    if script.Parent.Queue.Value >0 then
        Notification.Position = Notification.Position +UDim2.new(0,0, 0,(-105*script.Parent.Queue.Value))
    end
    Notification:TweenPosition(UDim2.new(0,0,0), UDim2.new(0,0,0,(-105*script.Parent.Queue.Value))), "Out", "Sine", 1, false)
    wait(1)
    script.Parent.Queue.Value = script.Parent.Queue.Value + 1
end
0
Yup that seemed to fix it. Thank you very much! alberthutchins 12 — 8y
Ad

Answer this question