So I am trying to make a system where you can punch people and it sends them backwards. When I try to play the tween on line 7 I keep getting an error saying “Unable to cast value to Object”.
Here is the code:
game.ReplicatedStorage.CheckOtherPlr.OnServerEvent:Connect(function(plr, plr2Check: Player)
game.ReplicatedStorage.CheckOtherPlr:FireClient(plr2Check, plr)
end)
game.ReplicatedStorage.PunchPlr.OnServerEvent:Connect(function(plr, plrPunched)
local rootpart = plrPunched.Character.HumanoidRootPart
local twn = game:GetService("TweenService"):Create(rootpart.CFrame, TweenInfo.new(1.25, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), { Position = Vector3.new(rootpart.CFrame.Position.X, rootpart.CFrame.Position.Y, rootpart.CFrame.Position.Z + 10)})
twn:Play()
end)