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

Shooting a ball of wind... NOT WORKING!?

This is my script (in a LocalScript):

player = game.Players.LocalPlayer
char = player.Character
torso = char.Torso
mouse = player:GetMouse()

function press(key)
	key = key:lower()
	if key == "q" then
		Ball = Instance.new("Part")
		Ball.Parent = workspace
		Ball.Shape = "Ball"
		Ball.Size = Vector3.new(5, 5, 5)
		Ball.BrickColor = BrickColor.new("Institutional White")
		Ball.Name = "windball"
		Ball.Transparency = .4
		Ball.TopSurface = 0
		Ball.BottomSurface = 0
		Ball.CFrame = torso.CFrame * CFrame.new(0,0.5,-5)
		Bv = Instance.new("BodyVelocity")
		Bv.Parent = Ball
		Bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		Bv.Velocity = torso.CFrame.lookVector * 100
		game.Debris:AddItem(Ball,4)
		wait(3)
	end
end
mouse.KeyDown:connect(press)

I haven't put in a debounce system yet, since so far it seemed unnecessary.

It's supposed to shoot a ball of "wind" forward when you press Q. It won't work. I am also having a problem making a script that copy's the Wind Ball script into your backpack. This is what it is:

game.Players.PlayerAdded:connect(function(player)
	call = workspace.WindBall:clone()
	call.Parent = player.Backpack
	print(cloned)
end)

Doesn't work. I don't know if it isn't cloning or if the Wind Ball script is wrong, because I can't Play Solo from the studio and check my BackPack in the explorer (I can't Play Solo from the studio because the Starter Script isn't loading and Roblox Studio crashes)

Please, someone, help!

1 answer

✓ Accepted answer

If you press F9 in an online game, and click on "Local Console", it shows any errors from local scripts. It's basically an online version of the Output window. This is known as the developer console.

I ran your script and it gave this error: 23:33:24.678 - Players.Player1.PlayerGui.LocalScript:2: attempt to index global 'Player' (a nil value)

You see the problem? On line 1, you created the "player" variable, but on line 2 you try to use a "Player" variable (uppercase P) that you haven't defined yet.

You can use the developer console to find the other errors too. For example, line 7 errors because you should be using :lower() instead of :KeyLower(). Line 14 errors because you forgot to put windball in quotes (it's a string, and strings need to be surrounded by quotes).

4 comments

0

The Wind Ball should be working, but I don't think it's cloning right :/

0

There are two other errors in your script. Use the developer console and you'll be able to spot them.

0

Thanks! I didn't know Velocity and MaxForce needed to be lower case! Although, the cloning script didn't work.. Thanks though!

1

GOT THE CLONE SCRIPT TO WORK!!! THANK YOU!

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