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

If statements for physical properties?

Hey, I was just curious on how to make an if statement for a physical property. I have a door, when touched it changes material, basically, when this happens, the egg is suppose to detect it and change it's material also, but this doesn't happen. Any help, please?

if script.Parent.Parent.Portal.Material == Enum.Material.Neon then
    script.Parent.Material = "Neon"
end

3 comments

0

Are you sure that script.Parent is the thing you want? Is this in a touch function?

0

Yes.

0

When the portal/door is touched, it should light up both parent of the script and the door.

1 answer

Not really familiar with your file explorer so here it goes:

local door = script.Parent  --idk where your door is located
local egg = script.Parent.Parent -- just put where your egg is located

door.Touched:connect(function(hit)
	humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid then -- this checks if there's a humanoid to what hits the door
		   egg.Material = Enum.Material.Neon -- this changes the material of egg to neon
		end
end)

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