Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tweening a player's head?

Asked by 3 years ago
Edited 3 years ago

So I've been trying to tween a player's head, but I can't seem to get it working. It grabs the player's head correctly, it's just the tween that won't work. It's supposed to rotate the player's head 90 degrees when the part is touched.

If someone could give me an answer for why this isn't working I'd be very grateful!

local TweenService = game:GetService("TweenService")
local spininfo = TweenInfo.new(1,Enum.EasingStyle.Back)
local part = script.Parent
SpinVar = false

function OnTouched(PlayerPart)
local IsPlayer = PlayerPart.Parent:FindFirstChild("Humanoid")
if IsPlayer and SpinVar == false then
local Character = PlayerPart.Parent.Head

local Spin1 = TweenService:Create(Character,spininfo,{CFrame = Character.CFrame * CFrame.Angles(0,math.rad(90),0)})

Spin1:Play()
wait(1)
SpinVar = true

end
end
part.Touched:Connect(OnTouched)

1 answer

Log in to vote
0
Answered by 3 years ago

Figured it out! Putting it here for future reference.

Neck = Character.Neck
local Spin1 = TweenService:Create(Neck,spininfo,{C0 = Neck.C0 * CFrame.Angles(0,math.rad(90),0)})
Ad

Answer this question