Skip to content

Instantly share code, notes, and snippets.

@dianjuar
Last active July 1, 2022 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dianjuar/80c877ca46a9006e6800d8426bcc2969 to your computer and use it in GitHub Desktop.
Save dianjuar/80c877ca46a9006e6800d8426bcc2969 to your computer and use it in GitHub Desktop.
Roblox Scripts
local platform = script.Parent
local isTouched = false
local function fade(fadeDuration: number, reaperance: number)
local fadeIntervals = 29
local intervalFraction = fadeDuration / fadeIntervals
return function ()
if not isTouched then
isTouched = true
for count = 1, fadeIntervals do
platform.Transparency = count / fadeIntervals
wait(intervalFraction)
end
platform.CanCollide = false
wait(reaperance)
platform.CanCollide = true
platform.Transparency = 0
isTouched = false
end
end
end
platform.Touched:Connect(fade(3, 3))
function onTouched(Obj)
local h = Obj.Parent:FindFirstChild("Humanoid")
if h then
h.Health = 0
end
end
script.Parent.Touched:Connect(onTouched)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment