So, this is a meditate animation/script It's in a local script and all that.
It worked fine before I added the second debounce.
(Debounces are LSM -Light Side Meditation- and DSM-Dark Side Meditation) I was running into a problem where I could press X for DSM, and then turn it off with M, but I only want to turn off DSM with the DSM button, X and vice versa with M and LSM.
I noticed that the ParticleEmitters had all of their values correct, so the code must have ran through to the end. But it is not playing the animations, or enabling the PariticleEmitters (Which happens right after the animation is supossed to play.) There are no errors in the output at all, and it worked fine before I added in the extra debounce, so I think I have a few of the debounces mixed up or some that are preventing the code to run. I looked through and can't find the error..Any help would be appreciated.
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") char = game.Players.LocalPlayer hum = char.Character:FindFirstChild("Humanoid") mouse = char:GetMouse() print("found") Animation = Instance.new("Animation") Animation.AnimationId = "http://www.roblox.com/Asset?ID=252319477" -- Animation's id Animation.Name = "Meditate" animTrack = char.Character.Humanoid:LoadAnimation(Animation) asef = Instance.new("ParticleEmitter", char.Character.Torso) asef.Enabled = false asef.Color = ColorSequence.new(Color3.new(255/155,191/255,0/155), Color3.new(190/255,149/255,96/255)) asef.LightEmission = 0.8 asef.Size = NumberSequence.new(10) asef.Transparency = NumberSequence.new(0.3) asef.Lifetime = NumberRange.new(1) asef.Speed = NumberRange.new(0) LSM = false DSM = false mouse.KeyDown:connect(function(key) -- keydown function if key == "m" then if LSM and DSM == false then animTrack:Play() LSM = true asef.Enabled = true hum.WalkSpeed = 0 else if LSM == true and DSM == false then animTrack:Stop() LSM = false asef.Enabled = false hum.WalkSpeed = 16 end end end end) mouse.KeyDown:connect(function(key) -- keydown function if key == "m" then if LSM == true and DSM == false then repeat wait(0.1) hum.Health = hum.Health+0.4 until hum.Health == hum.MaxHealth or LSM == false end end end) --[DarksSide below]-- d = Instance.new("ParticleEmitter", char.Character.Torso) d.Enabled = false d.Color = ColorSequence.new(Color3.new(103/255,0/255,0/155), Color3.new(0/255,0/255,0/255)) d.LightEmission = 0.6 d.Size = NumberSequence.new(10) d.Transparency = NumberSequence.new(0.3) d.Lifetime = NumberRange.new(1) d.Speed = NumberRange.new(0) mouse.KeyDown:connect(function(key) -- keydown function if key == "x" then if DSM and LSM == false then animTrack:Play() DSM = true d.Enabled = true hum.WalkSpeed = 0 else if DSM == true and LSM == false then animTrack:Stop() DSM = false d.Enabled = false hum.WalkSpeed = 16 end end end end) mouse.KeyDown:connect(function(key) -- keydown function if key == "x" then if DSM == true and LSM == false then repeat wait(0.1) hum.Health = hum.Health+0.4 until hum.Health == hum.MaxHealth or DSM == false end end end)