#having trouble correcting a coding mistake with animations
1 messages · Page 1 of 1 (latest)
** You are now Level 2! **
u got the animation priority correct?
i think so
i might just send the code its probably easier that way
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local M1 = humanoid:LoadAnimation(script.Animations.M1)
local M2 = humanoid:LoadAnimation(script.Animations.M2)
local M3 = humanoid:LoadAnimation(script.Animations.M3)
local M4 = humanoid:LoadAnimation(script.Animations.M4)
local combo = 1
UIS.InputEnded:Connect(function(I,E)
if E then return end
if I.UserInputType == Enum.UserInputType.MouseButton1 then
if combo == 4 then
game.ReplicatedStorage.MainEvent:FireServer()
M4: Play()
spawn(function()
task.wait(.1)
combo = 1
end)
elseif combo == 3 then
game.ReplicatedStorage.MainEvent:FireServer()
M3: Play()
elseif combo == 2 then
game.ReplicatedStorage.MainEvent:FireServer()
M2: Play()
combo = combo + 1
elseif combo == 1 then
game.ReplicatedStorage.MainEvent:FireServer()
M1: Play()
combo = combo + 1
end
end
end)
these are the names of my anims
wait i think i just noticed the problem
hang on
nevermind
u got it?
wait only some of your animations works?
can I see the properties of m4?
the animation itself?
yeah in the animations folder
is animation priority action?
you can do it with script
oh really
im very new to scripting so i might ask some dumb questions
would i have to add a script for the animation or put this in an already existing script
just use the script you already have
okay
btw I mean
animation.Priority
yeah
M4.Priority = Enum.AnimationPriority.Action4
just put this line under "local M4 = humanoid:LoadAnimation(script.Animations.M4)"
okay, ill try it now and playtest thanks dude
if it doesnt work ill reupload my animation since i think itll be an issue with the ID
yeah, it might not be published correctly
im getting an error after adding this line
i put it under the line you said
can you send the script?
sure
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local M1 = humanoid:LoadAnimation(script.Animations.M1)
local M2 = humanoid:LoadAnimation(script.Animations.M2)
local M3 = humanoid:LoadAnimation(script.Animations.M3)
local M4 = humanoid:LoadAnimation(script.Animations.M4)
Enum.AnimationPriority.M4
local combo = 1
UIS.InputEnded:Connect(function(I,E)
if E then return end
if I.UserInputType == Enum.UserInputType.MouseButton1 then
if combo == 4 then
game.ReplicatedStorage.MainEvent:FireServer()
M4: Play()
spawn(function()
task.wait(.1)
combo = 1
end)
elseif combo == 3 then
game.ReplicatedStorage.MainEvent:FireServer()
M3: Play()
elseif combo == 2 then
game.ReplicatedStorage.MainEvent:FireServer()
M2: Play()
combo = combo + 1
elseif combo == 1 then
game.ReplicatedStorage.MainEvent:FireServer()
M1: Play()
combo = combo + 1
end
end
end)
was i supposed to add more than just that one line
yeah you just typed "Enum.AnimationPriority.M4" and its incorrect
oh
** You are now Level 3! **
do M4.Priority = Enum.AnimationPriority.Action4
yeah okay no error now, but its still the same issue#
keeps repeating the third m1 with no cycle back to the first
yeah it loops the third m1
no
third m1 is m3 or m1?
M3
well the combo dosent change if it is 3
so its just gonna be stuck on 3
UIS.InputEnded:Connect(function(I,E)
if E then return end
if I.UserInputType == Enum.UserInputType.MouseButton1 then
if combo == 4 then
game.ReplicatedStorage.MainEvent:FireServer()
M4: Play()
spawn(function()
task.wait(.1)
combo = 1
end)
elseif combo == 3 then
game.ReplicatedStorage.MainEvent:FireServer()
M3: Play()
combo += 1
elseif combo == 2 then
game.ReplicatedStorage.MainEvent:FireServer()
M2: Play()
combo += 1
elseif combo == 1 then
game.ReplicatedStorage.MainEvent:FireServer()
M1: Play()
combo += 1
end
end
end)
I changed "combo = combo + 1" to "combo += 1" cuz its shorter and cleaner
ah okay okay
i appreciate ur help really
im gonna paste this in now ill see what happens
oh my god bro
you're actually my goat
it works perfectly now
nice
thanks so much bro