#Change of animation isn't working
1 messages · Page 1 of 1 (latest)
what is the animation priority for each animation? they should be set to the highest if you want them to play over the default animations (Action4)
They were the normal idle and walk animations !!!
Should I set them both to action 4
?
** You are now Level 4! **
yes
** You are now Level 6! **
Alright, i've done that but the problem remains
`local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local idleAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthIdleAnimation")
local walkAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthWalkAnimation")
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local loadedWalkAnimation = humanoid:LoadAnimation(walkAnimation)
while wait() do
if humanoid.Health <= 50 then
loadedIdleAnimation:Play()
loadedWalkAnimation:Play()
else
loadedIdleAnimation:Stop()
loadedWalkAnimation:Stop()
end
end`
That's the code inside replicated storage
i need a little more information - when the script runs the animations don't play, fine. but do the regular default animations play at under 50%?
I think they still do ?
is this a local
or a server script?
Hi
this is probably local
its a normal script in startercharacterscripts
try a local script
you need this to be a localscript
scripts are for server systems
which works for all players
at the same time
we dont need that
for animations
animations can be handled from the client side
I put it as a local script but the problem still is occuring
Any errors?
No, none come up
Since its a client script
You can use runservice instead of while
its way better
i think the problem is the while loop.
so instead of while just put runservice
i doubt the problem is the while loop
runservice.renderstepped
you can find it in the docs
but make sure not to play the animation every frame
only play it if its not playing
its highlighted runservice in read
wym
runservice.renderstepped.wait() do
no
not like that
game:GetService("RunService").RenderStepped:Connect(function()
--anything inside while loop goes here
end)
beat me to it, but yea ^
The ) in end at the bottom is highlighted now
theres a problem in your script
can you provide a full script?
ill do it for you.
`local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local idleAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthIdleAnimation")
local walkAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthWalkAnimation")
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local loadedWalkAnimation = humanoid:LoadAnimation(walkAnimation)
game:GetService("RunService").RenderStepped:Connect(function()
if humanoid.Health <= 50 then
loadedIdleAnimation:Play()
loadedWalkAnimation:Play()
else
loadedIdleAnimation:Stop()
loadedWalkAnimation:Stop()
end)`
This is the full script :p
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local idleAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthIdleAnimation")
local walkAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthWalkAnimation")
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local loadedWalkAnimation = humanoid:LoadAnimation(walkAnimation)
game:GetService("RunService").RenderStepped:Connect(function()
if humanoid.Health <= 50 then
if not loadedIdleAnimation.IsPlaying then
loadedIdleAnimation:Play()
end
if not loadedWalkAnimation.IsPlaying then
loadedWalkAnimation:Play()
end
else
if loadedIdleAnimation.IsPlaying then
loadedIdleAnimation:Stop()
end
if loadedWalkAnimation.IsPlaying then
loadedWalkAnimation:Stop()
end
end
end)
Here you go.
i feel there should be more checks
wym
as it stands i feel that if both aren't playing then it will try to play the idle - only to be overwritten by the walking animation
I think thats just happened...
that was his script
do you want the walk animation
to play
only when moving?
Mhm !!
Sorry that's my bad I should've made that clear
Thank you both so much for the help btw, i'm still getting used to scripting so it very helpful :]
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local root = character:FindFirstChild("HumanoidRootPart")
local idleAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthIdleAnimation")
local walkAnimation = game.ReplicatedStorage:FindFirstChild("LowHealthWalkAnimation")
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local loadedWalkAnimation = humanoid:LoadAnimation(walkAnimation)
game:GetService("RunService").RenderStepped:Connect(function()
if humanoid.Health <= 50 then
if not loadedIdleAnimation.IsPlaying then
loadedIdleAnimation:Play()
end
if root.Velocity.Magnitude > 2 then
if not loadedWalkAnimation.IsPlaying then
loadedWalkAnimation:Play()
end
else
if loadedWalkAnimation.IsPlaying then
loadedWalkAnimation:Stop()
end
end
else
if loadedIdleAnimation.IsPlaying then
loadedIdleAnimation:Stop()
end
if loadedWalkAnimation.IsPlaying then
loadedWalkAnimation:Stop()
end
end
end)
** You are now Level 14! **
here you go
ywyw
always
no problem man
IT WORKS YIPPIEE TYTYTY
Now i've got to sort out my other problem 😭
It's so unrelated, want me dm you it so i can close this ?
we can continue here
okie
Well, i've made a shop person who you can chat to, he'll ask "Would you like to see the shop" (not the actual dialogue but its what he is asking) and you can reply "Yes" and after you press yes, the Dialogue UI closes and the shop UI opens
I've tried so many different scripts and ways but nothing works
does the dialogue ui atleast appear?
Yeah !!
can i see your current code?
For the dialogue ui closing ?
Okie, it's a kit thing I used for the ui and stuff but i understand it
`local dialogueKitModule = require(script.Parent.Parent.DialogueKit)
local dialoguePrompt = workspace:WaitForChild("DialoguePrompts"):WaitForChild("TestPrompt1").PromptPart.ProximityPrompt
dialoguePrompt.Triggered:Connect(function(player)
dialogueKitModule.CreateDialogue(
{
InitialLayer = "Layer1",
SkinName = "DefaultDark",
Config = script.Config,
Layers = {
Layer1 = {
Dialogue = {
'Hey '..game.Players.LocalPlayer.Name.."!",
"I'm Serial Designation N, nice to meet you!",
"I sell drone skins, providing new mysterious abilites for you to explore !"
},
DialogueSounds = {nil, nil},
DialogueImage = "rbxassetid://85352409508609",
Title = "Serial Designation N",
Replies = {
reply1 = {
ReplyText = "I'd like to purchase a skin",
ReplyLayer = "Layer2"
},
_goodbye = {
ReplyText = "Thanks for the info, bye !",
}
},
Exec = {
}
},
Layer2 = {
Dialogue = {"Of course ! It'll cost you quite a bit though ! "},
DialogueSounds = {},
DialogueImage = "rbxassetid://85352409508609",
Title = "Serial Designation N",
Replies = {
},
Exec = {
}
},
}
}
)
end)`