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

Bug or simple mistake in my gun's sound script?

Asked by 4 years ago
Edited 4 years ago

I've been trying to make a gun in my game for a little bit, im having a little trouble with the sound though. I have put my gun in the starter pack and the sound in there too. Whenever I test the script, it says GS is not a valid member of Tool "Players.NovaGooBoom.Backpack.GUNFORGAME"

Script:

local tool = script.Parent local sound = tool.GS tool.Activated:Connect(function() sound:Play() end)

Thanks

1 answer

Log in to vote
1
Answered by 4 years ago

Assuming that the script is in the tool, your sound is probably NOT in the tool, and assuming that it's in the starterpack/backpack you will just simply need to change from this:

local tool = script.Parent local sound = tool.GS tool.Activated:Connect(function() sound:Play() end)

To this:

local tool = script.Parent local sound = tool.Parent.GS tool.Activated:Connect(function() sound:Play() end)
0
Sound was in the tool, but instead I just moved the sound and changed the variable to that. Helped me work through this though, so thanks. NovaGooBoom 42 — 4y
Ad

Answer this question