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

Any Idea What's Wrong With This?

Asked by 10 years ago

I'm using this script inside a tool, but for some reason it's not working at all.

script.Parent.Equipped:connect(function (m)
    m.KeyDown:connect(function (key)
        if key == "f" then
            Rocket = Instance.new("Part", game.Workspace)
            Rocket.Size = Vector3.new(1,1,4)
            Rocket.BrickColor = BrickColor.new("Bright red")
            Mesh = script.Parent.Mesh:Clone()
            Mesh.Parent = Rocket
            Rocket.Position = script.Parent.Handle.Position + Vector3.new(0, 3, 0)
            RP = Instance.new("RocketPropulsion", Rocket)
            RP.Target = m.Target
            RP:Fire()
            RP.CartoonFactor = 1
            newScript = script.Explosion:Clone()
            newScript.Parent = Rocket
            newScript.Disabled = false
            RP.MaxThrust = 10000
            RP.MaxSpeed = 1000
        end
    end)
end)

Anyone see what I did wrong? EDIT: It appears to be working just fine in the studio solo test, but when I go online it completely stuffs up.

0
If it helps, the console output was 'logging probability 0.59614237285971 not logging' SquirreIOnToast 309 — 10y

2 answers

Log in to vote
-1
Answered by
HexC3D 830 Moderation Voter
10 years ago

script.Parent.Equipped:connect(function (m) m.KeyDown:connect(function (key) if string.lower(key) == "f" then Rocket = Instance.new("Part", game.Workspace) Rocket.Size = Vector3.new(1,1,4) Rocket.BrickColor = BrickColor.new("Bright red") Mesh = script.Parent.Mesh:Clone().Parent = Rocket Rocket.Position = script.Parent.Handle.Position + Vector3.new(0, 3, 0) RP = Instance.new("RocketPropulsion", Rocket) RP.Target = m.Target -- WHAT IS M? RP:Fire() RP.CartoonFactor = 1 newScript = script.Explosion:Clone().Parent = Rocket -- Not defined newscript is not anywhere so it will be equa to nill unless mention somewhere else. newScript.Disabled = false RP.MaxThrust = 10000 RP.MaxSpeed = 1000 end end) end)

Hopes this helps. I got the same error and decided to use string.lower()

Ad
Log in to vote
-2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

In line 3, your code for that is a bit inefficient. Put if key:lower() == "f" then

0
Still not working. SquirreIOnToast 309 — 10y

Answer this question