Is it Roblox or Me?

issue
I am having an issue where it says “Sound is not a class of Script.” It gives me any error when I attempt to play the sound.
To fix it I started to move it around and add waitforchild/findfirstchild but I still couldn’t play it and got an error.

script.Parent.Attachment.ProximityPrompt.Triggered:Connect(function(player)
	local module=require(game:GetService("ServerScriptService").InteractionsScript.Door)
	module:two(script.Parent.Parent.Parent,false,script.Parent,script.Parent.Parent)
	script.Sound:Play()
end)
1 Like

Could it be that you’re not giving it enough time to load? You could load it outside of the event and just play it there

local module =require(game:GetService("ServerScriptService").InteractionsScript.Door)
local thing = script.Parent

local sound = script:WaitForChild("Sound")

thing.Attachment.ProximityPrompt.Triggered:Connect(function(player)
	module:two(thing.Parent.Parent,false,thing,thing.Parent)
	sound:Play()
end)

Added the “Thing” variable to help make things are bit less repetitive, you just make the sound variable and change script.Sound to sound

Or wait, maybe rename the Sound to something else?

1 Like

Looking at it, I think it is because I delete its parent quickly after I call the module function.

That could be it since it would be gone by then, maybe play it first and t hen run the module?

I think I will just clone it into the new model it creates. It has the same CFrame so it would give me the same effect.

That would work if they’re far apart, but if they’re closer together, it’s better to just play the sound first imo, but to each their own of course!

Well thinking about that its a door idek. I’ll see what happens as I go on.

1 Like

Alright, Good luck! If you have anymore issues don’t be afraid to make another psot!

1 Like

Most likely lol. There are a lot of things im doing rn

1 Like