this script does not play the anim , but as soon as i jump from the seat it freezes the players character also theres an error Jumping is not a valid member of AnimationTrack “sitanim”
how long is the animation?
also to fix the error change anim.Jumping:Connect(function() to humanoid.Jumping:Connect(function()
the script seems promising yet it does not play the animation the only output the script has is Infinite yield possible on 'Workspace:WaitForChild("SeatTest") line 26
the animation is a few seconds and it works perfectly with the script which i mentioned above, this script works if i add it inside the seat
seat = script.Parent
function added(child)
if (child.className=="Weld") then
human = child.part1.Parent:FindFirstChild("Humanoid")
if human ~= nil then
anim = human:LoadAnimation(seat.sitanim)
anim:Play()
end
end
end
function removed(child2)
if anim ~= nil then
anim:Stop()
anim:Remove()
end
end
seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)
oops, replace the workspace:WaitForChild(“SeatTest”) with workspace:WaitForChild(“SitTest”)
i made a typo
oh haha i did not even notice that anyways now it says
LoadAnimation requires an Animation object line 10
human:LoadAnimation(sitanim), i swear to drunk i’m not god
try this for i, v in pairs(game.Workspace:WaitForChild(“SitTest”):GetChildren()) do
if v:FindFirstChild(“sitanim”) then
v.Touched:Connect(function(hit)
local animation = v:FindFirstChild(“sitanim”)
if animation then
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if humanoid then
local anim = humanoid:LoadAnimation(animation)
anim:Play
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
end
end
end)
end
end)
end
end
thats funny now because at line 11 “anim” is never defined
does not play the anim and when i get off the seat it makes my character in the falling state like this
I dont know if this will work (probably not)
game.Player.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
for i, v in pairs(game.Workspace:WaitForChild(“SitTest”):GetChildren()) do
if v:FindFirstChild(“sitanim”) then
v.Touched:Connect(function(hit)
if hit.Parent == character
local animation = v:FindFirstChild(“sitanim”):Clone
if animation then
local anim = humanoid:LoadAnimation(animation)
anim:Play
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
anim:Destroy()
end
end
end)
end
end)
end
end
end)
omg! it almost worked the only problem is it plays the seatanim after i jump off the seat perfectly rather than playing it when the player sits on the seat ;(
ok Im gonna try to fix it
game.Player.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
for i, v in pairs(game.Workspace:WaitForChild(“SitTest”):GetChildren()) do
if v:FindFirstChild(“sitanim”) then
local animation = v:FindFirstChild(“sitanim”):Clone
local anim = humanoid:LoadAnimation(animation)
anim:Play
anim:Stop
v.Touched:Connect(function(hit)
if hit.Parent == character
if animation then
anim:Play
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
anim:Destroy()
animation = v:FindFirstChild(“sitanim”):Clone
anim = humanoid:LoadAnimation(animation)
anim:Play
anim:Stop
end
end)
end
end
end)
end
end
end)
i fixed the syntax a bit yet theres an error apparently
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
for i, v in pairs(game.Workspace:WaitForChild("SitTest"):GetChildren()) do
if v:FindFirstChild("sitanim") then
local animation = v:FindFirstChild("sitanim"):Clone()
local anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
v.Touched:Connect(function(hit)
if hit.Parent == character then
if animation then
anim:Play()
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
anim:Destroy()
animation = v:FindFirstChild("sitanim"):Clone()
anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
end
end)
end
end
end)
end
end
end)
Cannot load the AnimationClipProvider Service. line 8
try this maybe?
game.Player.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild(“Humanoid”)
for i, v in pairs(game.Workspace:WaitForChild(“SitTest”):GetChildren()) do
if v:FindFirstChild(“sitanim”) then
local animation = v:FindFirstChild(“sitanim”):Clone()
task.wait(1/60)
animation.Parent = character
local anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
v.Touched:Connect(function(hit)
if hit.Parent == character
if animation then
anim:Play()
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
anim:Destroy()
animation = v:FindFirstChild(“sitanim”):Clone()
task.wait(1/60)
animation.Parent = character
anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
end
end)
end
end
end)
end
end
end)
yep that fixed the error even though the same issue occurs where the animation plays right after i jump off the seat
try this:
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
for i, v in pairs(game.Workspace:WaitForChild("SitTest"):GetChildren()) do
if v:FindFirstChild("sitanim") then
local db = false
local animation = v:FindFirstChild("sitanim"):Clone()
task.wait(1/60)
animation.Parent = character
local anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
v.Touched:Connect(function(hit)
if hit.Parent == character and db == false then
if animation then
db = true
anim:Play()
humanoid.Jumping:Connect(function(check)
if check then
anim:Stop()
anim:Destroy()
animation = v:FindFirstChild("sitanim"):Clone()
task.wait(1/60)
animation.Parent = character
anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
task.wait(0.2)
db = false
end
end)
end
end
end)
end
end
end)
Same thing no errors but the animation plays right after i jump off the seat
I tried to do what the script that works does so this might work
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
for i, v in pairs(game.Workspace:WaitForChild("SitTest"):GetChildren()) do
if v:FindFirstChild("sitanim") then
local db = false
local animation = v:FindFirstChild("sitanim"):Clone()
task.wait(1/60)
animation.Parent = character
local anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
v.ChildAdded:Connect(function(hit)
if hit.part1.Parent == character and db == false then
if animation then
db = true
anim:Play()
v.ChildRemoved:Connect(function()
anim:Stop()
anim:Destroy()
animation = v:FindFirstChild("sitanim"):Clone()
task.wait(1/60)
animation.Parent = character
anim = humanoid:LoadAnimation(animation)
anim:Play()
anim:Stop()
task.wait(0.1)
db = false
end)
end
end
end)
end
end
end)
ANd that finally worked! THANK U SO MUCH , ive literally wasted a day because of this stupid script and u were the only heplful person!!