Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This scripts works perfectly in studio, but doesn't work in the actual game, how can i solve that?

The script is local and it's located in the starterGUI. I would really appreciate some help on this. Here's the script:

local me = game.Players.iiiAmericanLight
local chr = me.Character
local dg = Instance.new("ParticleEmitter")
dg.Parent = chr:FindFirstChild("Right Arm")
dg.Texture = game.ReplicatedStorage.DemonGlow.Texture
dg.Size = game.ReplicatedStorage.DemonGlow.Size
dg.Speed = game.ReplicatedStorage.DemonGlow.Speed
dg.Color = game.ReplicatedStorage.DemonGlow.Color
dg.LightEmission = game.ReplicatedStorage.DemonGlow.LightEmission
dg.LightInfluence = game.ReplicatedStorage.DemonGlow.LightInfluence
dg.Lifetime = game.ReplicatedStorage.DemonGlow.Lifetime
dg.Rate = game.ReplicatedStorage.DemonGlow.Rate
dg.LockedToPart = true

local dm = Instance.new("Decal")
dm.Name = "dm"
dm.Parent = chr.Head
dm.Texture = game.ReplicatedStorage.DemonMark.Texture
dm.Color3 = game.ReplicatedStorage.DemonMark.Color3

local dt = Instance.new("Part")
dt.Transparency = 1
dt.Size = game.ReplicatedStorage.MarkAuraB.Size	
dt.Parent = chr.Head
dt.CanCollide = false

local weld = Instance.new("Weld")
weld.Part0 = dt
weld.Part1 = chr.Head
weld.C0 = weld.C0*CFrame.new(-0.3, -0.4, 0.45) 
weld.Parent = dt


local ma = Instance.new("ParticleEmitter")
ma.Parent = dt
ma.Size = game.ReplicatedStorage.MarkAura.Size
ma.Lifetime = game.ReplicatedStorage.MarkAura.Lifetime
ma.Rate = game.ReplicatedStorage.MarkAura.Rate
ma.Color = game.ReplicatedStorage.MarkAura.Color
ma.Speed = game.ReplicatedStorage.MarkAura.Speed
ma.LightEmission = game.ReplicatedStorage.MarkAura.LightEmission
ma.LightInfluence = game.ReplicatedStorage.MarkAura.LightInfluence
ma.Texture = game.ReplicatedStorage.MarkAura.Texture

21 comments

0

It doesn't work for you or other players?

0

it is supposed to work only for me, but it doesn't work at all in the game.

0

Have you tried putting .Parent last?

0

i'll try that

0

Also is Filtering Enabled on?

0

it is not

0

Can you show us your output please?

0

of course

0

If it still doesn't work, press F9 in studio or game, and if there's a error, please report it to me. Note: There are two tabs call "Client Log" and "Server Log", please report both errors to me. Server Log only works on a game, not Roblox Studio.

0

Output is F9, by the way.

0

nothing in my output

0

Also, if the .Color .Lifetime for the ParticleEmitter is not a Value, like a StringValue, then you could clone them, instead of doing it all over again.

0

How about put this in the first line: local me = game.Players:FindFirstChild("iiiAmericanLight"), and this in the second line: if me ~= nil then

0

local script

0

Try adding wait() on top of the script

0

did you try my answer

0

it worked <3

0

accept then please <3

0

the problem was in wait()

0

Thanks everyone <3

3 answers

✓ Accepted answer

Maybe you're referencing the character before it actually existed, as characters load after the player is added. Here's how I set my character variable each time the character loads or disappears.

local char = player.Character or player.CharacterAdded:Wait()

1 comment

0

I suppose the Character might be the problem, you might be right.

The error is on lines 1-2. You’re referencing your Player object before it’s added and your Character as well, you shouldn’t do it like this. You should instead use a Players.PlayerAdded event to check if the player is you.

game:GetService('Players').PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        if plr.UserId == 48617255 then -- grabbed your user id lol
            -- Do code.
        end
    end)
end)

You can add before the object selected a WaitForChild()

example:

-- The objct you want is a part called : Blue
****
part = game.Workspace:WaitForChild("Blue")

-- WaitForChild() means that the script will continue to wait until he founds an object that correspond to ourdescription, in this case is : "Blue"

You need to do this only when you define an object, you Don't have to do this to define a size, position, ...

This discussion is preserved as it was. New answers, comments, and votes are closed.