Как создать кнопку
У меня на сцену добавлен блок с картинкой. Я хочу, чтобы он работал как кнопка, открывающая дверь. То есть, когда я кликну по блоку мышкой, другой блок должен стать прозрачным и проницаемым.

local r1=script.Parentlocal function opendor() r1.Parent.dver.Transparency =1 r1.Parent.dver.CanCollide=falseendr1.ClickDetector.MouseClick:connect(opendor)r1.Touched:Connect(opendor)
Важно! Здесь dver - имя блока, который является той самой дверью.
Взрыв, который зависит от скорости
Сфера катится и взрывается, когда достигает определенной скорости.
RunService = game:GetService("RunService")
rsf = script.Parent
function cvel()
a=rsf.AssemblyLinearVelocity.Magnitude
if a>3 then
explosion = Instance.new("Explosion")
wait(5)
explosion.BlastRadius = 20
explosion.Position =rsf.Position
explosion.BlastPressure =300000
explosion.Parent = rsf.Parent
explosion.DestroyJointRadiusPercent =1
explosion.Hit:Connect(function(part,distance)
end)
game.Debris:AddItem(rsf, 3)
end
end
local connection = RunService.Stepped:Connect(cvel)Скрипт для подъемной платформы
clickDetectorlift = script.Parent.Clicker.ClickDetector
pc = script.Parent.Parent.Shaft.PrismaticConstraint
up=false
clickDetectorlift.MouseClick:Connect(function()
up = not up
pc.TargetPosition =up and 0 or -24
end)
Скрипт для лазера
local mylaser=script.Parentmylaser.Touched:Connect(function(hit) hit.Parent.Humanoid.Health-=100end)
Вывод здоровья персонажа в текстовую метку
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local MainHealthBar = script.Parent
local TextLabel = script.Parent.Parent.showh
local function updateHealth()
local BarSize = math.clamp(Humanoid.Health / Humanoid.MaxHealth, 0, 1)
TextLabel.Text = "Health: " .. tostring(math.floor(BarSize * 100)).."%" -- You are able to adjust what is shown on the bar here.
end
updateHealth()
Humanoid:GetPropertyChangedSignal("Health"):Connect(updateHealth)
Humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(updateHealth)Это авторский материал. Если вы будете использовать этот текст, вы должны указать ссылку на источник. https://studiareweb.com/