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

Set new player with game pass on fire?

Asked by 8 years ago

I've made the script but it doesn't seem to be working. No errors or output..

function onPlayerEntered(newPlayer)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(newPlayer, 384198804) then
        newPlayer.CharacterAdded:connect(function(character)
        local char = character
        local kids = char:GetChildren()
        for _,k in pairs(kids) do
                if k.ClassName == "Part" then
                local fire = Instance.new("Fire")
                fire.Parent = k
                end     
            end
        end)
    end
end

1 answer

Log in to vote
1
Answered by 8 years ago

This should be able to fix all your current issues. It should also re-add fire upon re spawning

game.Players.PlayerAdded:connect(function(plr)
   plr.CharacterAdded:connect(function(char)
        local service = game:GetService("MarketplaceService")
        if service:PlayerOwnsAsset(plr, 331486478) then
            for _,k in pairs(char:GetChildren()) do
                     if k.ClassName == "Part" then
                       local fire = Instance.new("Fire",k)
                 end
              end
         end
      end)
end)





~~Approved by koolkid8099

0
Thank you so much! A simple fix. You're very helpful. Others might have gotten angry at the fact that I messaged them, and disregarding my entire post upon doing so. Tradesmark 65 — 8y
0
I was almost positive the script would work, but unfortunately it does the same thing in studio. No error to output and there are obviously no flames to be seen. I made sure to add the call. Tradesmark 65 — 8y
0
add prints to your code to see where it errors koolkid8099 705 — 8y
0
I've tried this and no prints show up, it's very unusual. Tradesmark 65 — 8y
View all comments (27 more)
0
add a print to the first line. koolkid8099 705 — 8y
0
add a print to every line to see if it prints koolkid8099 705 — 8y
0
if not the script isn't enabled or somewhere it cant run. koolkid8099 705 — 8y
0
Ahh wait it made it up until this line. Tradesmark 65 — 8y
0
newPlayer.CharacterAdded:connect(function(character) Tradesmark 65 — 8y
0
try replacing that with" repeat wait() until newPlayer.Character ". Dont forget to remove on of the ends. koolkid8099 705 — 8y
0
attempt to index local 'char' (a nil value) Tradesmark 65 — 8y
0
define char as newPlayer.Character koolkid8099 705 — 8y
0
It works! The fire is super bright though. I'll need to adjust that. Tradesmark 65 — 8y
0
If someone joins however, they will lose the fire when they die. How do I fix this? Tradesmark 65 — 8y
0
I'm going to edit my code with the proper code you should have koolkid8099 705 — 8y
0
Will you be posting it here? Tradesmark 65 — 8y
0
Yes, i just updated my answer koolkid8099 705 — 8y
0
It should work now. koolkid8099 705 — 8y
0
Now it does not work at all. No output or anything. Tradesmark 65 — 8y
0
what kind of script is this? koolkid8099 705 — 8y
0
What do you mean? Tradesmark 65 — 8y
0
I jsut tested my self, this is a roblox bug. koolkid8099 705 — 8y
0
give me a second, im going to make you a work around koolkid8099 705 — 8y
0
That would be amazing. Tradesmark 65 — 8y
0
Ok, it was not a bug. It was an issue with the location of events, sorry for the delay koolkid8099 705 — 8y
0
It works now koolkid8099 705 — 8y
0
So it will stay with the player even after death? Tradesmark 65 — 8y
0
It still will not work. D: Tradesmark 65 — 8y
0
Nevermind it works. Tradesmark 65 — 8y
0
Longest comment train I have ever seen. You're awesome Koolkid for helping until the answer gets solved. User#11440 120 — 8y
0
LOL koolkid8099 705 — 8y
Ad

Answer this question