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

Every time I press Shift my script isnt activating the particles what am I doing wrong?

Asked by 4 years ago

I am making a jetpack to attach on my player and I have scripted this

local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse()

mouse.KeyDown:connect(function(key) if string.byte(key) == 48 then workspace.Jetpack.Fire2.Jetpack1 = Enabled workspace.Jetpack.Fire2.Jetpack2 = Enabled end end)

Every time I press Shift the particles don't activate and I get this error in the Output - ****Jetpack1 is not a valid member of Part

Any help is appreciated! :)

0
Jetpack1 must not be a part of Fire2. Make sure it is a child of Fire2. Also, you can't set Jetpack1 and Jetpack2 to enabled. You have to write it like this: Jetpack1.Enabled = true Hypgnosis 186 — 4y

1 answer

Log in to vote
0
Answered by
AltNature 169
4 years ago

Please, please, PLEASE use UIS - User Input Service! Key Down Is Deprecated!

local uis = game:GetService("UserInputService")

uis.InputBegan ............... -- you do the rest 

you might want to add a Waitforchild() infront of "dot jetpack1"

you definetly want to add 'WaitForChild()` infront of LocalPlayer

please be be sure to quit using key down and please use code block! it is the blue "lua" Circle you see when typing your request for help

hope this helps AltNature [Lua / Blenderer]#2828

Ad

Answer this question