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

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

Asked by 9 years ago

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

Log in to vote
4
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

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).

0
The Wind Ball should be working, but I don't think it's cloning right :/ User#5565 45 — 9y
0
There are two other errors in your script. Use the developer console and you'll be able to spot them. Merely 2122 — 9y
0
Thanks! I didn't know Velocity and MaxForce needed to be lower case! Although, the cloning script didn't work.. Thanks though! User#5565 45 — 9y
1
GOT THE CLONE SCRIPT TO WORK!!! THANK YOU! User#5565 45 — 9y
Ad

Answer this question