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

Any Idea What's Wrong With This?

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.

1 comment

0

If it helps, the console output was 'logging probability 0.59614237285971 not logging'

2 answers


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

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

1 comment

0

Still not working.

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