local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Mouse = Player:GetMouse() Mouse.Button1Down:Connect(function() if Mouse.Target.Parent:FindFirstChild("Humanoid")then print("Mouse.Target ==" ..Mouse.Target.Name) local Distance = (Character.HumanoidRootPart.Position - Mouse.Target.Parent.HumanoidRootPart.Position).magnitude if Distance <= 20 then print(Distance) local OtherPlr = Mouse.Target.Parent game.ReplicatedStorage.Grab:FireServer(Player,OtherPlr) end else print("Mouse.Target ==" ..Mouse.Target.Name) end end)
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
game.ReplicatedStorage.Grab.OnServerEvent:Connect(function(Player,OtherPlr) OtherPlr.HumanoidRootPart.Position = Player.Character.HumanoidRootPart.Position end)
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?
I did an oopise and I fired the event with "Player" in there
game.ReplicatedStorage.Grab:FireServer(Player,OtherPlr)
i just removed the Player and it worked.