#When I press 2, my T.rex stops
1 messages · Page 1 of 1 (latest)
What's the script?
Here's the movement code
Lemme get the rest
Here's the calls
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
-- Roar state
local isRoaring = false
-- === Broadcast Roar ===
local broadcastAnim = Instance.new("Animation")
broadcastAnim.AnimationId = "rbxassetid://123552972399365"
local broadcastSound = Instance.new("Sound")
broadcastSound.SoundId = "rbxassetid://134725024064440"
broadcastSound.Volume = 1
broadcastSound.Name = "BroadcastRoarSound"
broadcastSound.Parent = hrp
local broadcastTrack = humanoid:LoadAnimation(broadcastAnim)
broadcastTrack.Priority = Enum.AnimationPriority.Action
broadcastTrack.Looped = false
-- === Aggro Roar ===
local aggroAnim = Instance.new("Animation")
aggroAnim.AnimationId = "rbxassetid://117503416295803"
local aggroSound = Instance.new("Sound")
aggroSound.SoundId = "rbxassetid://126707578316377"
aggroSound.Volume = 1
aggroSound.Name = "AggroRoarSound"
aggroSound.Parent = hrp
local aggroTrack = humanoid:LoadAnimation(aggroAnim)
aggroTrack.Priority = Enum.AnimationPriority.Action
aggroTrack.Looped = false
-- === Roar Trigger Handler ===
local function playRoar(track, sound)
if isRoaring then return end
isRoaring = true
sound:Play()
track:Play()
track.Stopped:Connect(function()
isRoaring = false
end)
end
-- === Input Handler ===
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed or isRoaring then return end
if input.KeyCode == Enum.KeyCode.One then
playRoar(broadcastTrack, broadcastSound)
elseif input.KeyCode == Enum.KeyCode.Two then
playRoar(aggroTrack, aggroSound)
end
end)
Here they are
** You are now Level 1! **
Nope, it just freezes when I press 2 while holding w and shift
What is it?
The aggroTrack is being loaded by the humanoid, it needs to be loaded by humanoid.Animator
So basically: local aggroTrack = humanoid.Animator:LoadAnimation(aggroAnim)
No problem
It's in this one you gave me
Ah
Alr lemme try
Uh, it didn't work.
Idk if I wrote it correctly
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
-- Roar state
local isRoaring = false
-- === Broadcast Roar ===
local broadcastAnim = Instance.new("Animation")
broadcastAnim.AnimationId = "rbxassetid://123552972399365"
local broadcastSound = Instance.new("Sound")
broadcastSound.SoundId = "rbxassetid://134725024064440"
broadcastSound.Volume = 1
broadcastSound.Name = "BroadcastRoarSound"
broadcastSound.Parent = hrp
local broadcastTrack = humanoid:LoadAnimation(broadcastAnim)
broadcastTrack.Priority = Enum.AnimationPriority.Action
broadcastTrack.Looped = false
-- === Aggro Roar ===
local aggroAnim = Instance.new("Animation")
aggroAnim.AnimationId = "rbxassetid://117503416295803"
local aggroSound = Instance.new("Sound")
aggroSound.SoundId = "rbxassetid://126707578316377"
aggroSound.Volume = 1
aggroSound.Name = "AggroRoarSound"
aggroSound.Parent = hrp
local aggroTrack = humanoid.Animator:LoadAnimation(aggroAnim)
aggroTrack.Priority = Enum.AnimationPriority.Action
aggroTrack.Looped = false
-- === Roar Trigger Handler ===
local function playRoar(track, sound)
if isRoaring then return end
isRoaring = true
sound:Play()
track:Play()
track.Stopped:Connect(function()
isRoaring = false
end)
end
-- === Input Handler ===
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed or isRoaring then return end
if input.KeyCode == Enum.KeyCode.One then
playRoar(broadcastTrack, broadcastSound)
elseif input.KeyCode == Enum.KeyCode.Two then
playRoar(aggroTrack, aggroSound)
end
end)
@gritty vector
Note: Even without the calls script. It would still stop the rex when I hold shift and w
I think it within the movement code
this one
But is the animation playing fine?
** You are now Level 2! **
Wait, was the roar animation published by you?
wdym?
The roar animation you made, when you press 2
If it doesn't play maybe it can break
I bought it from someone
Ohh, that's the issue
I've had the same issue because roblox only allows animations to work in studio if you publish them in your place
Hold on, just to make this easier. Can we go into private vc so I can stream it to you?
And then i made one code for a mini cutscene and it did not work because the animation did not played since the id of it was uploaded by a friend of mine
I see
@gritty vector
Sorry i can't rn
Well, if you didn't upload the animation, try uploading it and copy the id of the animation
And then you would need to paste the animation id into the id properties of the animation
And then it might work
If it doesn't work maybe yeah, it could be an issue with the movement script but i don't think so since you said the issue only happens after you press two, and the script making the animation play when you press 2 is this one
OH
I thought you meant where I got the animations from
My bad
Yes, I have uploaded the animations provided in the model and published them into my inventory
@gritty vector
But the animations were purchased from someone as I said earlier
They were provided in a model
Yes
Update: It seems like it is the movement code
cool ass t-rex tho
Yeah, though I bought it from someone who used to own a Jurassic World game