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

I don't understand how to script this function?

Here's mt script I'm running

function ot()
	script.Parent.Material = 272
	wait(0.1)
	script.Parent.Material = 288
	
end
script.Parent.Touched:connect(ot) 

I want to make it so the Material of the part changes to neon once the player stands on it, then reverts back once they step down, this changes it while they're standing on it, is there a way to make it so it stays Neon while on the part, then change once they step down without it flickering?

1 comment

0

There ya go

2 answers

Parts also have the TouchEnded event to monitor when something stops touching the part.

function onTouched()
	script.Parent.Material = 272
end

function onTouchEnded()
	script.Parent.Material = 288
end

script.Parent.Touched:connect(onTouch)
script.Parent.TouchEnded:connect(onTouchEnded)

1 comment

1

Thank you @Funyun, I had to switch the material values as it was opposite of what I wanted, but this help a lot!

In your touched a brick script you need in the arguments hit or whatever you wanna call it like this:

function ot(hit)
    script.Parent.Material = 272
    wait(0.1)
    script.Parent.Material = 288

end
script.Parent.Touched:connect(ot) 

Hope this helps!

2 comments

0

not really

0

Thanks, but this makes the brick stay as neon until I step back on it and it flickers back to neon

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