当たると透明になって透き通るブロック【Roblox Studio】

当たると透明になって透き通るブロック(Part)を作るスクリプト

local Part = script.Parent
local isChanging = false

function onTouch(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	
	if isChanging == false and humanoid ~= nil then
		isChanging = true
		wait(1)
		Part.Transparency = 0.5
		Part.CanCollide = false
		wait(3)
		Part.Transparency = 0
		Part.CanCollide = true
		isChanging = false
	end
end

script.Parent.Touched:connect(onTouch)

コメントを残す

メールアドレスが公開されることはありません。