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

What does this error mean?

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

✓ Accepted answer

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!

1 comment

0

Thanks!

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