我有一個叫做門的模型 Inside我有一個名爲Open的BoolValue 我有一個名爲Top的模型,它有所有名爲Work Mabey Comeon和Proboblynot的門塊 而且我有Block,當被觸摸時應該使Top move高達Roblox上的lua腳本向上移動模型?
直接在門口,我有此腳本
door = script.Parent
open = door.Open
Top = door.Top
opener = 18
speed = 100
steps = speed
startl = Top.CFrame
function MoveDoorToCFrame(cfrm,dr)
dr.Work.CFrame = cfrm
dr.Mabey.CFrame = dr.Work.CFrame * CFrame.new(0,-7.2,0)
dr.Comeon.CFrame = dr.Work.CFrame * CFrame.new(0,10.8,0)
dr.Problynot.CFrame = dr.Work.CFrame * CFrame.new(0,10.8,0)
end
function Update()
if speed/steps < 0.5 then
calc = 1-math.cos(math.rad((-90/speed)*steps*2))
else
calc = 1+math.sin(math.rad((90/speed)*((speed/2)-steps)*2))
end
MoveDoorToCFrame(startl * CFrame.new(0,(calc/2)*opener,0),Top)
end
Update()
while true do
wait()
if not open.Value and steps < speed then
steps = steps + 1
Update()
elseif open.Value and steps > 0 then
steps = steps - 1
Update()
end
end
是應該激活觸摸按鈕裏面我有
script.Parent.Touched:connect(function()
script.Parent.Parent.Open.Value = not script.Parent.Parent.Open.Value
end)
script.Parent.Parent.Open.Changed:connect(Update)
Update()
如果您知道如何解決這個問題,我們將很樂意爲您解答。
我很抱歉,我的另一個項目,忘了這一點,當我看到這些問題的答案我很高興的是,大家的幫助下,我去你的腳本,它花了幾次嘗試,但我得到它的工作。 – Crazynerd314
它永遠讓我罰款它說的地方Top:TranslateBy它應該是門沒有頂部,但謝謝你的幫助,這提高了我的士氣10倍。大拇指。 – Crazynerd314