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

Handle is not apart of tool?

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)


3 comments

0

Can you send a screenshot upload to gyazo or imgur to show us the tool descendants?

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

0

Make sure the handle is a child of the tool

2 answers

✓ Accepted answer

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

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.

1 comment

0

Where do I type Wait for child

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