How to make an opening door in Roblox Studio
Link to the script: https://github.com/denkodin/RobloxStu...
Link to the model in Roblox: https://www.roblox.com/library/480344...
- DoorScript
```
local Hinge = script.Parent.PrimaryPart
local opened = false
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0))
wait()
end
else
opened = false
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0))
wait()
end
end
end
script.Parent.Handle1.ClickDetector.MouseClick:Connect(OpenDoor)
script.Parent.Handle2.ClickDetector.MouseClick:Connect(OpenDoor)
```
How to make a working bed in Roblox Studio
Link to the script: https://github.com/denkodin/RobloxStu...
Link to the model in Roblox: https://www.roblox.com/library/449199...
- BedScript.lua
```
local Cooldown = 3
local CurrentPlayer = nil
local CallbackHandler = nil
local CName = 'BedCooldown'
function StandupFromBed()
if CurrentPlayer ~= nil and script.Parent:FindFirstChild("WeldConstraint") then
local C = Instance.new("StringValue", CurrentPlayer)
C.Name = CName
game.Debris:AddItem(C, Cooldown)
script.Parent.WeldConstraint:Remove()
if CallbackHandler ~= nil then
CallbackHandler:disconnect()
CallbackHandler = nil
end
CurrentPlayer.Humanoid.PlatformStand = false
CurrentPlayer.HumanoidRootPart.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(180), 0) + Vector3.new(0, 5, 0)
CurrentPlayer.HumanoidRootPart.Anchored = true
wait()
CurrentPlayer.HumanoidRootPart.Anchored = false
CurrentPlayer = nil
end
end
function LayToBed(character)
if character ~= nil and not script.Parent:FindFirstChild("WeldConstraint") then
CurrentPlayer = character
CurrentPlayer.HumanoidRootPart.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(90), 0, math.rad(-90))
CurrentPlayer.Humanoid.PlatformStand = true
local Weld = Instance.new("WeldConstraint", script.Parent)
Weld.Part0 = script.Parent
Weld.Part1 = character.HumanoidRootPart
CallbackHandler = CurrentPlayer.Humanoid.Changed:Connect(function(property)
if CurrentPlayer ~= nil and property == 'Jump' then
StandupFromBed()
end
end)
end
end
script.Parent.Touched:Connect(function(hit)
local Character = hit.Parent
if Character:FindFirstChild("Humanoid") and CurrentPlayer == nil and not Character:FindFirstChild(CName) then
LayToBed(Character)
end
end)
```
'tech > game' 카테고리의 다른 글
21/07/19 EASILY MAKE 3D MODELS FROM SCRATCH! - WITH THIS FREE OPEN SOURCE TOOL (0) | 2021.07.19 |
---|---|
21/07/19 How To Import Meshes from 3D Model Sites (ROBLOX STUDIO) (0) | 2021.07.19 |
21/07/19 ROBLOX Tutorial | 5 Door Methods (0) | 2021.07.19 |
21/07/19 메타버스를 주도하는 로블록스에 주목하라 (0) | 2021.07.19 |
21/07/19 Develop and Publish Flappy Bird in 3 Hours With Unity3D (0) | 2021.07.19 |