Setting Player's position by mouse shows abnormal values when printed. Why?
Hello everyone! I am working with somewhat teleknesis script which changes other player's position as the initial player drags his/her mouse but it shows abnormal values. This is what i have scripted till now:-
01 | local player = game.Players.LocalPlayer |
02 | local camera = game.Workspace.CurrentCamera |
03 | local uis = game:GetService( "UserInputService" ) |
04 | local mouse = player:GetMouse() |
05 | local attachedToPlayer = false |
06 | local GotTarget = false |
08 | local toggleOfUIS = false |
10 | mouse.Move:Connect( function () |
11 | if toggleOfUIS = = false then |
12 | if mouse.Target.Parent:FindFirstChild( "Humanoid" ) then |
22 | uis.InputBegan:Connect( function (input) |
23 | if input.KeyCode = = Enum.KeyCode.T then |
24 | if toggleOfUIS = = false then |
26 | if GotTarget = = true then |
27 | attachedToPlayer = true |
28 | repeat Target.Parent.HumanoidRootPart.Position = Target.Parent.HumanoidRootPart.Position + Vector 3. new(mouse.X, mouse.Y, 0 ) |
30 | until toggleOfUIS = = false or attachedToPlayer = = false |
31 | print (Target.Position) |
33 | elseif toggleOfUIS = = true then |
35 | attachedToPlayer = false |
Please someone help!!