Trouble with a tool that tweens the player to a position

I’m trying to make a hand that moves a player to a location if you hit them with it, but it doesn’t seem to work. I couldn’t find out what was wrong. if you have any ideas please tell me : )

script:

wait(.5)

local tool = script.Parent
local plr = game.Players.LocalPlayer
local sound = workspace.ThrowDestination.Sound

local TweenService = game:GetService("TweenService")

script.Parent.Handmesh.Touched:connect(function(object)

	local hrp = object.Parent:FindFirstChild("HumanoidRootPart")
	
	if not hrp or hrp.Parent == plr.Character
	then 
		return end
	
	local info = TweenInfo.new(.5)

	local Animation = TweenService:Create(hrp, info, {CFrame = CFrame.new(workspace.ThrowDestination.Position)})
	Animation:Play()

	if not sound.IsPlaying 
	then
		sound:Play()
	end
end)

You cannot edit other person’s character position with a LocalScript, it will not be replicated. I recommend using a RemoteEvent.

1 Like

how would I go about doing that? if I have to have another separate script, how would I check if the part that the hand touched wasn’t the local player across scripts?

When using RemoteEvent:FireServer(Argument) the first parameter on server is always the player:

RemoteEvent.OnServerEvent:Connect(function(player, argument1)
    print(player.UserId)
end)
1 Like