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

How come this not work? EDIT

EDIT: Its a level up system, and when a player levels up this happens.

I have the level up script somewhere else, this part just won't work. :P

player = game.Players.LocalPlayer

local fireworks = Instance.new("Part") 
fireworks.Shape = 0 
fireworks.formFactor = "Symmetric" 
fireworks.Size = Vector3.new(1,1,1) 
fireworks.BrickColor = BrickColor.Random() 
fireworks.CFrame = player.Character.Head.CFrame + Vector3.new(0,2,0) 
fireworks.Parent = game.Workspace 
game:GetService("Debris"):AddItem(fireworks, 2) 
fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) 

2 comments

1

Error messages?

0

Try 'player.Character.Head.Position' instead of using 'player.Character.Head.CFrame'.

1 answer

I don't know where this doesn't work exactly, as you didn't tell us, so i'll try to go without them:

local player = game.Players.LocalPlayer --This variable is out of any functions, or perhaps it IS in a function you are hiding from us here and you are using it here. If you are only using it here, if it is in a function using the below you are hiding from us, set it to local. And if it is indeed out of any functions (therefore at the top of the script) set it to local then too.

local fireworks = Instance.new("Part", Workspace) --You can set the parent of the created instance from Instance.new
fireworks.Shape = 0
fireworks.FormFactor = "Symmetric" --FormFactor, not formFactor. Are you confusing this with other functions in other games with similiar programming?
fireworks.Size = Vector3.new(1,1,1) 
fireworks.BrickColor = BrickColor.Random() 
fireworks.Position = player.Character.Head.Position + Vector3.new(0,2,0) --No reason to use CFrame here - Also, for CFrame you would have to do "CFrame.new(player.Character.Head.Positon + Vector3.new(0,2,0))"
game:GetService("Debris"):AddItem(fireworks, 2) 
fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30))

Hopefully i helped.

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