#Material Detection Not Working

1 messages · Page 1 of 1 (latest)

brazen stirrup
#

Hello, it is me again. I haven't scripted in a while and now I am slowly losing track of it. The script in question is that I am trying to make a part that kills you by default, but it can be toggled off with a ProximityPrompt. It shows no errors in the script, but it is not working and I do not know why. Here is the script that I made below.

local killCylinder = script.Parent

local interact = killCylinder:FindFirstChild("ProximityPrompt")

local function toggleCylinder()
    if killCylinder.Material == "Neon" then
        killCylinder.Material = "SmoothPlastic"
        killCylinder.Transparency = 0.5
    else
        killCylinder.Material = "Neon"
    end
end

interact.Triggered:Connect(toggleCylinder)```
potent kindle
#

does the problem still persist even if you used Enum.Material

potent kindle
#

ok

inland hare
silent shadowBOT
#

studio** You are now Level 2! **studio

brazen stirrup
inland hare
#

Do you have a script somewhere that already does the killing part?

desert marlin
#

yeah do you have a script that checks the part's material and does the killing part or not?

red crystal
#

the porximity prompt might not be loaded in yet. i suggest use WaitForChild() instead of FindFirstChild()