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

Decal is not a valid member of Part?

So for my stupid scripting mistake, but I can't get the decal in this script to go from 1 Transparency to 0. It keeps giving me an error as (16:47:30.928 - Decal is not a valid member of Part). It seems so simple for a beginner but I keep getting stumped why the Decal won't work...

Switch = script.Parent
Decal = game.Workspace.StaticScareWalkTo.Static.Decal

boolean = true

function onTouched(Switch)
	if boolean == true then
		script.Parent.Sound:Play()
		Decal.Transparency = 0
		wait(10)
	end
end

script.Parent.Touched:connect(onTouched)

2 comments

0

That's because 'Decal' doesn't exist in the location you are referring it too. Perhaps it hasn't loaded or it's in a different area.

0

I think it is loaded and in the correct position. Im sure. I did make the transparency at one so when you touch the brick the script will tell the decal to go to 0 transparency so you can see it

1 answer

✓ Accepted answer

Try this. If it doesn't work I'm sorry there isn't enough for me to look at, hope this helps! :)

Switch = script.Parent
Decal = game.Workspace:WaitForChild("StaticScareWalkTo"):WaitForChild("Static"):WaitForChild("Decal")

boolean = true

function onTouched(Switch)
    if boolean == true then
        script.Parent.Sound:Play()
        Decal.Transparency = 0
        wait(10)
    end
end

script.Parent.Touched:connect(onTouched)

6 comments

0

use the copy tool on the top right when you hover over the code

0

Please do not simply post code; Add some kind of explanation behind your answer, otherwise, the user will fail to understand 'Why is this necessary?', or, 'I don't see any changes in the code, it's the same code'. Please post some kind of Explanation.

0

Explanation: You did not wait for the parts and decals to load, so you add a :WaitForChild("") to wait for the part or decal (child)

0

Ok thanks guys I understand now!

0

That is sort-of right, but, let me explain; The 'WaitForChild' method is a method where it will yield (pause/stop) the code, and will wait until a child with the matching name of the Argument has become existant within it's 'Parent' [Parent:WaitForChild(Child)], then, will return the Instance.

0

Thats the exact same thing that I said... Just said differently

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