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

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

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

✓ Accepted answer

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

1 comment

0

Yup that seemed to fix it. Thank you very much!

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