What do you want to achieve?
Hey, I’m trying to achieve a animation of someone sitting. They click the proximety point, it teleports them to a certain point, (where the rig is in roblox studio), and then runs the animation. When I made the animation, it worked perfectly, but in-game, it doesn’t work. I also tried to add something where they user STAYS sitting, but for some reason I ran into trouble with it.
-
What is the issue? Include screenshots / videos if possible!
The issue is that in-game it does not work.
(in animation editor)
(in-game)
Script that I have currently (Clicks on proximety point, teleports them to a point, and runs the animation
local part = script.Parent
local proximityPrompt = part:FindFirstChildOfClass("ProximityPrompt")
local teleportPosition = Vector3.new(174.152, 21.443, 498.463)
local animationId = 'rbxassetid://18364464705'
local animation = Instance.new("Animation")
animation.AnimationId = animationId
local function playAnimation(player)
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
end
end
end
local function teleportPlayer(player)
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = CFrame.new(teleportPosition)
end
end
end
proximityPrompt.Triggered:Connect(function(player)
teleportPlayer(player)
playAnimation(player)
end)
What solutions have you tried so far?
The only solution I thought to maybe fix it was to allow the user to not collide (phase) through the chair as I thought it would be an issue with that, but nope. Any help in advance is appreciated!