Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help with fire scripted to the players torso?

Asked by 4 years ago
Edited 4 years ago

hello i am making a game, but in the game i wanted my player to have fire in his torso so i kinda looked like a vortex, i have made it in studio and then put the model to code so when i spawn im the only one who has it, but its dont seem to work, it prints the text at the end but dont add fire to my torso. if anyone could help me and show where i went wrong that would be so helpful.

Thank you in advance

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if plr.Name == "UpOntoNebula" then
            local fire = Instance.new("Fire", char.LowerTorso)
            fire.Color = Color3.new(44, 0, 67)
            fire.SecondaryColor = Color3.new(25, 109, 88)
            fire.Heat = 2
            fire.Size = 3
            fire.Enabled = true
            print("Fire Added")
        end
    end)
end)
0
Have you set the fire to enabled? MrCatDoggo 213 — 4y
0
it is enabled but when i go in test i cant find the fire within my player UpOntoNebula 0 — 4y
0
does it print fire added, if not put it under plr.Name and tell me if it prints it then Echtic 128 — 4y
0
yeah it prints fire added UpOntoNebula 0 — 4y

1 answer

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago
Edited 4 years ago

Hello, I will help you with this one:

  1. You should use :Connect instead of :connect because :connect is deprecated.
  2. You should set parent after you do all the changes to the instance (https://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296)
  3. Other than that I didn't find anything wrong, make sure it is in ServerScriptService or Workspace and it is inside of Script

Fixed code:

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        if plr.Name == "UpOntoNebula" then
            local fire = Instance.new("Fire")
            fire.Color = Color3.new(44, 0, 67)
            fire.SecondaryColor = Color3.new(25, 109, 88)
            fire.Heat = 2
            fire.Size = 3
            fire.Enabled = true
            fire.Parent = char.LowerTorso
        end
    end)
end)

Fixed code is tested and it's working.

Ad

Answer this question