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

What does this error mean?

Asked by 9 years ago

Dragging property won't work for this TextLabel and I don't know why, so I decided to try and make my own dragging script, but it didn't work. There is one error:

Players.Player.PlayerGui.ScreenGui.PlrCount.DragS:24: bad argument #3 to 'Position' (UDim2 expected, got number)

Here is the script:

-- Can't see because small screen

script.Parent.Text = "Players Online\n".. game.Players.NumPlayers

function Update()
script.Parent.Text = "Players Online\n".. game.Players.NumPlayers
end

game.Players.ChildAdded:connect(Update)
game.Players.ChildRemoved:connect(Update)

-- game.StarterGui.ScreenGui.PlrCount script

plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
mp = mouse.X, mouse.Y

script.Parent.MouseEnter:connect(function()
    mouse.Button1Down:connect(function()
        if plr.PlayerGui.Drag.Value == false then
            plr.PlayerGui.Drag.Value = true
            while true do
                game:GetService("RunService").RenderStepped:wait()
                plr.PlayerGui.ScreenGui.PlrCount.Position = mp
            end
        else
            plr.PlayerGui.Drag.Value = false
        end
    end)
end)

1 answer

Log in to vote
3
Answered by 9 years ago

Basically what that error means is that on line 24, when you set the Position of PlrCount, you gave it a number value instead of a UDim2 value. In order to fix that, change plr.PlayerGui.ScreenGui.PlrCount.Position = mp to plr.PlayerGui.ScreenGui.PlrCount.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y). Hope this helped!

0
Thanks! Senor_Chung 210 — 9y
Ad

Answer this question