oh, sorry, no it doesnt. just once
So after it touches the hitbox you don’t want to run the code again?
Nope, just once.
char limitttt
Okay, let me write the entire code from the start
wow, alright. good luck!
char limit
See if this works
local RunService = game:GetService("RunService")
local Camera = game.Workspace:WaitForChild("Camera")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://10405924371" -- 10406276727 10406528662
local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
local TouchedConnection
TouchedConnection = game.Workspace.Test.Touched:Connect(function()
TouchedConnection:Disconnect()
AnimationTrack:Play()
Humanoid.WalkSpeed = 0
local AnimationEnded = false
AnimationTrack.Stopped:Connect(function()
AnimationEnded = true
end)
Camera.CameraType = Enum.CameraType.Scriptable
while AnimationEnded == false do
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Character.Head.Position)
RunService.RenderStepped:Wait()
end
Humanoid.WalkSpeed = 16
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = Humanoid
end)
it works! one little detail is that the player turns, im guessing to the direction the Part is facing. any way to fix that?
also, thank you so much for doing this for me. i appreciate it.
That is odd, when I test it does not happen
maybe you could provide a recording so I can see what is happening
does it happen when the character is in third person?
the game is lockedfirstperson, so i’m not sure
try replacing this line with
Camera.CFrame = Character.Head.CFrame
now that makes my character rotate until the animation is finished…
try this
local RunService = game:GetService("RunService")
local Camera = game.Workspace:WaitForChild("Camera")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://10405924371" -- 10406276727 10406528662
local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
local TouchedConnection
TouchedConnection = game.Workspace.Test.Touched:Connect(function()
TouchedConnection:Disconnect()
AnimationTrack:Play()
Humanoid.WalkSpeed = 0
local AnimationEnded = false
AnimationTrack.Stopped:Connect(function()
AnimationEnded = true
end)
Camera.CameraType = Enum.CameraType.Scriptable
while AnimationEnded == false do
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Character.Head.Position)
RunService.RenderStepped:Wait()
end
Camera.CFrame = Character.Head.CFrame
Humanoid.WalkSpeed = 16
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = Humanoid
end)
that doesn’t seem to work either. i’ve realized that its not the part’s roration, the character just gets turned around in a 360
did you change the character’s speed to keep it in place?
yep, when the animation plays my character does a 360, and i’m not controlling it. the player can’t move until the animation is done
This is the last I could think of
local RunService = game:GetService("RunService")
local Camera = game.Workspace:WaitForChild("Camera")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://10405924371" -- 10406276727 10406528662
local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
local TouchedConnection
TouchedConnection = game.Workspace.Test.Touched:Connect(function()
TouchedConnection:Disconnect()
AnimationTrack:Play()
Character.Head.Anchored = true
local AnimationEnded = false
AnimationTrack.Stopped:Connect(function()
AnimationEnded = true
end)
Camera.CameraType = Enum.CameraType.Scriptable
while AnimationEnded == false do
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Character.Head.Position)
RunService.RenderStepped:Wait()
end
Character.Head.Anchored = false
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = Humanoid
end)