How would I drag a player to my hand?

  1. What do you want to achieve?
    I am trying to drag a player to my hand.

  2. What is the issue?
    I used a tween but I keep getting an error, “Unable to cast CoordinateFrame to TweenInfo”

  3. What solutions have you tried so far?
    I looked on the Developer Hub and only found small things about tweening.

game.ReplicatedStorage.Edere.OnServerEvent:Connect(function(Player, Mouse)		
		local ts = game:GetService("TweenService")	
		local hrp = Mouse.Parent.HumanoidRootPart	
		local magic = Player.Character:WaitForChild("Humanoid"):FindFirstChild("Magic")
		local animation = script.Caster
		local loadedanim = Player.Character.Humanoid:LoadAnimation(animation)
		local magicCost = 5
		wait(.1)		
		if magic.Value >= magicCost then
		local anim = ts:Create(hrp, {Position = Player.Character.RightHand.CFrame})
		magic.Value -= magicCost
		loadedanim:Play()
		anim:Play()
		Mouse.Parent:FindFirstChild("RagdollR15"):WaitForChild("Activate").Value = true
		anim.Completed:Connect(function()		
		Mouse.Parent:FindFirstChild("RagdollR15"):WaitForChild("Activate").Value = false
		loadedanim:Stop()
		end)
	end
end)

Any help is appreciated, thanks!

There is a local script that I use to fire the “Edere” event, but I know it is not the issue as I get an error for the server script.

local player = game.Players.LocalPlayer
local debounce = false
local character = player.Character
local root = character.HumanoidRootPart
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
local fireevent = game.ReplicatedStorage.Edere
local spell = false


player.Chatted:Connect(function(msg)
	if string.find(msg:lower(),"edere") ~= nil and debounce == false and spell == false then
		spell = true
	end
end)

mouse.Button1Down:Connect(function()
	local mousetarg = mouse.Target
	if mouse.Target:IsA("BasePart") then
		if mouse.Target.Parent.Humanoid and debounce == false and spell == true then
			debounce = true
			fireevent:FireServer(mousetarg)
			wait(2)
			spell = false
			debounce = false
			print("cooldown over!!")
		end
	end
end)
1 Like

You’re missing tweeninfo inside your tween:Create() parameters and also setting Position to a CFrame, replace it with this

		local anim = ts:Create(hrp, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {CFrame = Player.Character.RightHand.CFrame})

I tried this and unfortunately they didn’t come towards me, they just stayed in place. The animation played though and they ragdolled. Thank you though

video of what happens: https://gyazo.com/ea54614d6c3c7ebf1cac33608fb05a3f