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

How come this not work? EDIT

Asked by
iNicklas 215 Moderation Voter
9 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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)) 
1
Error messages? dyler3 1510 — 9y
0
Try 'player.Character.Head.Position' instead of using 'player.Character.Head.CFrame'. dyler3 1510 — 9y

1 answer

Log in to vote
0
Answered by
Marios2 360 Moderation Voter
9 years ago

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.

Ad

Answer this question