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

Fireball script, works only in studio, not in game. Help Please?

Asked by
Rikuzao 20
9 years ago

Hey, i have edited Friaza's fireball script witch only works in Studio, not in-game. Anyways, here's the script:

01Player = script.Parent.Parent -- Gets LocalPlayer
02Character = Player.Character -- Gets Players Character
03Mouse = Player:GetMouse() -- Gets players Mouse
04function onKeyDown(key)
05    key = key:lower()
06    if key == "z" then
07        x = Instance.new("Part")
08        x.TopSurface = "Smooth"
09        x.BottomSurface = "Smooth"
10        x.Shape = "Ball"
11        x.Transparency = .7
12        x.BrickColor = BrickColor.new("Bright red")
13        f = Instance.new("Fire")
14        f.Parent = x
15        f.Size = 12
View all 26 lines...

Please help!

2 answers

Log in to vote
2
Answered by 9 years ago

On the first line, instead of putting,

1Player = script.Parent.Parent

put this:

1Player = game.Players.LocalPlayer
0
It does not work since the first thing i did after putting it into workspace was putting it into starerpack Rikuzao 20 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

The difference between PlaySolo and In game is that In game, the character loads a little after the Player loads. In Playsolo, the character and Player load immediately. To fix this, we wait for the Character to load using repeat wait() until Player.Character

01Player = script.Parent.Parent -- Gets LocalPlayer
02repeat wait() until Player.Character
03Character = Player.Character -- Gets Players Character
04Mouse = Player:GetMouse() -- Gets players Mouse
05function onKeyDown(key)
06    key = key:lower()
07    if key == "z" then
08        x = Instance.new("Part")
09        x.TopSurface = "Smooth"
10        x.BottomSurface = "Smooth"
11        x.Shape = "Ball"
12        x.Transparency = .7
13        x.BrickColor = BrickColor.new("Bright red")
14        f = Instance.new("Fire")
15        f.Parent = x
View all 27 lines...

Answer this question