Hey there! I’m currently experiencing a strange issue that I have never seen before, and have not found much info at all about online. I am working on a medical item that works akin to the herb-spray canisters from the Resident Evil series. There is a catch though; that the substance is flammable. If you are on fire and use it, the canister will explode.
When in studio, everything works perfectly fine, however when a player uses the item on themself ingame, the server freezes for a few seconds, and then kicks everyone while displaying an “Error 277” code. I do not get any errors in studio, and the processes work without any issue. My code goes as follows:
local Tool = MyTool
local Used = true
local selfAnim = MyAnim1
local idleAnim = MyAnim2
local Sound = MySound
local PE = MyParticleEmitter
-- Stuff initialized earlier in the script
local Humanoid = Tool.Parent:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health < Humanoid.MaxHealth then
Used = true
-- Boolean to stop spam, earlier in the code
selfAnim:Play()
Sound:Play()
PE.Enabled = true
-- Play animation, sound, and start the emitter
wait(0.5)
-- This wait doesn't trigger the 277 error
if Humanoid.Parent:FindFirstChild("FireParticle", true) ~= nil then
-- If the character has fire in it
local ExSound = Tool.Handle.Explode
ExSound:Play()
-- Play the explode sound
local Explode = Instance.new("Explosion", workspace)
Explode.BlastPressure = 0
Explode.BlastRadius = 0
Explode.Position = Tool.Handle.Position
-- Make a nonlethal explosion
Humanoid:TakeDamage(100)
-- Kill or severely injure the player
-- wait(1)-------------------------------------------------------
-- Wait a bit for the sound and explosion to end, then destroy the tool
Tool:Destroy()
else
-- Else if the character is not on fire
-- wait(1)-------------------------------------------------------
PE.Enabled = false
-- Wait a bit and stop the emitter and sound
Sound:Stop()
-- wait(1)-------------------------------------------------------
-- Wait a moment so the particles have time to fade away
idleAnim:Stop()
if Tool.Parent.ClassName ~= "Backpack" then
-- If the user still has the tool in their hand, then move a healing script into their character, as well as destroy the tool
local Healer = script.Healer:Clone()
Healer.Parent = Humanoid.Parent
Healer.Disabled = false
Tool:Destroy()
end
end
end
You may have taken notice that my wait(1)
lines are commented out. For some reason, this seems to make the error not occur. If I uncomment the wait lines, the server crashes. The server will crash regardless of what user activates this code. Though, I kind of need these waits in order to make the item not instantly usable, and to give the affects time to fade away.
I am completely dumbfounded as to what is going on. When I searched around online for ‘error 277’ things, all I could find are vague references to servers running out of memory. This doesn’t make sense to me though, as this happens when no other code has run yet, and the server has just opened up. Also, I will add just in case anyone asks, this is the only code running at the time. Nothing in the background, no spawn()s, or anything. This also only affects ingame, playtesting in Studio does not produce this error. This originally made me think this could be a server/client issue, and was not affecting me since Studio merges the two. I don’t think this is the case though, as all of the code above is ran in a single server script.