[SOLVED] Server thinks I'm referring to the Player Even tho I'm referring to the character...?
Asked by
4 years ago Edited 4 years ago
01 | local Player = game.Players.LocalPlayer |
02 | local Character = Player.Character or Player.CharacterAdded:Wait() |
03 | local Mouse = Player:GetMouse() |
05 | Mouse.Button 1 Down:Connect( function () |
06 | if Mouse.Target.Parent:FindFirstChild( "Humanoid" ) then |
07 | print ( "Mouse.Target ==" ..Mouse.Target.Name) |
08 | local Distance = (Character.HumanoidRootPart.Position - Mouse.Target.Parent.HumanoidRootPart.Position).magnitude |
09 | if Distance < = 20 then |
11 | local OtherPlr = Mouse.Target.Parent |
12 | game.ReplicatedStorage.Grab:FireServer(Player,OtherPlr) |
15 | print ( "Mouse.Target ==" ..Mouse.Target.Name) |
alr so I'm trying to make a script that teleports a player to the player that clicked him, but it doesn't seem to work and It's even confusing,
above is the LocalScript in the StarterPack, and below is the ServerScript
1 | game.ReplicatedStorage.Grab.OnServerEvent:Connect( function (Player,OtherPlr) |
2 | OtherPlr.HumanoidRootPart.Position = Player.Character.HumanoidRootPart.Position |
The error I'm getting is
HumanoidRootPart is not a valid member of Player "Players.Player1"
Seems like it thinks that I'm referring to the player itself but I'm referring to the character... any knows why it gives me that error?