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

This script only works in Studio Mode?

Asked by 8 years ago

It's a local script in the starter Gui.

here's the script

local char=game.Players.LocalPlayer.Character
local gui=Instance.new("ParticleEmitter")

gui.Parent=char.Torso
gui.Texture = "http://www.roblox.com/asset/?id=160041569"
gui.VelocitySpread = 45

All Help Is appreciated!

2 answers

Log in to vote
0
Answered by 8 years ago

Char is nil

LocalScripts run before the Character is added. Perhaps use this:

local p = game.Players.LocalPlayer;
local char = p.Character or p.CharacterAdded:wait();

woof woof
Ad
Log in to vote
0
Answered by
yoshi8080 445 Moderation Voter
8 years ago

Here's the revision

local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:wait()  -- wait for the character before the script starts
local torso = char:WaitForChild('Torso') -- wait for the charcter's torso
local gui = Instance.new("ParticleEmitter",torso) -- You can put torso here instead of using parent.

gui.Texture = "http://www.roblox.com/asset/?id=160041569"
gui.VelocitySpread = 45
-- rest of your emitter settings here

Answer this question