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

"Handle is not a valid member of tool" - Error????

Asked by 5 years ago

I have two weapons I've made & scripted using the same fashion for both. One works completely fine (M1911) & the other (Ak-47) doesn't work at all. Now I know its because of this one error that keeps popping up, "Handle is not a valid member of tool"? I have a handle inside of my tool exactly like my M1911 which works just fine. Now note my Ak did work at one point before I tried adding sound effects for, equip, reload, magazine in, & empty clip effects. Also note that I added the same effects with different audio for the M1911. The script below is my main code and mind you im getting an error for the handle under my variables where I define handle.

001-- Variables
002 
003local tool = script.Parent.Parent
004local hole = tool.barrel
005local handle = tool.Handle
006local canShoot = true
007local config = tool.Config
008local ammo = config.Ammo
009local maxammo = config.MaxAmmo
010local dmg = config.Damage
011local allowtrace = config.AllowTracing
012local clips = config.Clips
013local range = config.Range
014local plr = game:GetService("Players").LocalPlayer
015local cooldown = config.CoolDown
View all 105 lines...

Now ive gone through & placed notes where the sounds are called upon to play. Any other info to help me solve this I can also provide. Thanks for the help!

~GoodkidMad

0
Can I see the models? royaltoe 5144 — 5y
0
Maybe you are refrencing your tool wrong? Check if the tool is actually script.Parent.Parent royaltoe 5144 — 5y
0
Sure where should I send the links too GoodkidMad 14 — 5y
0
& No thats the first thing I checked. Trust me for me to be asking on here i've gone through the complete checklist of what could have been wrong. GoodkidMad 14 — 5y
View all comments (3 more)
0
Try using WaitForChild() or like referencing the thing handle from script.Parent.Parent.Handle itself maybe? Not the best coder here btw. RebornedInFire 35 — 5y
0
send a link here royaltoe 5144 — 5y
0
Sent on roblox to your messages the model GoodkidMad 14 — 5y

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

The script was loading before the handle loaded, wait for the handle to load:

1local handle = tool:WaitForChild("Handle")
0
I saw that you saw my message. Did you manage to fix it? royaltoe 5144 — 5y
0
Yes I just tried that & it fixed my issue. Man I literally was so lost for like a week & all because of a simple wait. The life of a programmer :p GoodkidMad 14 — 5y
0
Glad it fixed it. Can you please mark the solution I posted as answered so it's easier for people with similar problems to search for it? royaltoe 5144 — 5y
0
thx royaltoe 5144 — 5y
Ad

Answer this question