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

Handle is not apart of tool?

Asked by 4 years ago

It states that the handle is not apart of the tool although it is and I made sure there was no misspells and there weren't

local gun = script.Parent

local gun_sound = script.Parent.Handle["gun shot 1"]



local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')



gun.Equipped:Connect(function(mouse)



    mouse.Button1Down:Connect(function()

        remoteEvent:FireServer(gun.Handle.Position, mouse.Hit.p)

        gun_sound:Play()
print("worked local")
    end)



end)


0
Can you send a screenshot upload to gyazo or imgur to show us the tool descendants? BashGuy10 384 — 4y
0
please define the descendants of the tool in an image and what line the script is erroring on for me to give a clear answer MLGwarfare04 183 — 4y
0
Make sure the handle is a child of the tool 0Papa_Rat0 63 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

Try putting the script in the handle and then doing Script.Parent instead of Script.Parent.Handle

Ad
Log in to vote
0
Answered by 4 years ago

If you're sure the script is parented to the tool, and so is the Handle without misspellings, my best guess would be that the Handle hasn't loaded in yet and the script is already trying to define it.

Instead of using

local gun_sound = script.Parent.Handle["gun shot 1"]

trying using :WaitForChild so you wait for the Handle to load in before proceeding.

0
Where do I type Wait for child jhjryoutube 29 — 4y

Answer this question