如何让对象在特定时间间隔内在 ROBLOX 中消失?

How can you make an object disappear in ROBLOX over a certain interval?

我正在用 ROBLOX 制作游戏,游戏一开始就有过场动画。在过场动画结束时,镜头拉近角色,然后你重生。然而,当我重生时,我可以看到我在过场动画中使用的假人,那么在一定时间间隔后你如何让那个假人消失?

假人只需要隐形吗?如果是这样,ROBLOX 中的每个物理对象(或更正式地说 Part) has a .Transparency field that spans from 0 (for no transparency) to 1 (for full transparency, or in other words, invisible). I don't know what your "dummy" looks like in the object hierarchy, but let's say your dummy were a Model 位于 workspace.dummy,并且它有头部、躯干、左臂等位于 workspace.dummy.Headworkspace.dummy.Torsoworkspace.dummy.LeftArm 等。要使虚拟部件的部分不可见,您的代码应如下所示:

workspace.dummy.Head.Transparency = 1
workspace.dummy.Torso.Transparency = 1
workspace.dummy.LeftArm.Transparency = 1
...

等等。 然而,这将使虚拟对所有玩家不可见。如果您正在制作单人游戏,这无关紧要;但是,如果它是多人游戏,那么这可能是个问题。 再次让假人不透明来为新玩家做过场动画会让所有玩家都可以看到假人。如果这对你来说是个问题,你可以做两件事我知道:

第一种也是最简单的方法是让过场动画发生在离游戏发生地很远的地方;例如,您可以在 X 方向移动过场动画 10,000 个螺柱中的所有内容。这将确保过场动画中的对象不在玩实际游戏的玩家的渲染距离内,因此只有那些正在操纵摄像机执行过场动画的玩家才能看到它。

第二个更复杂,不是面向未来的选项涉及一个非常有用的错误,该错误经常被利用但随时可能被修复,因为它不是官方功能。此错误是在撰写本文时对 Camera (or less commonly a Message, which is deprecated) to create what are called local parts—Parts only visible to a certain player. How to create local parts and discussion of benefits and consequences of using local parts is a little complicated and beyond the scope of this answer. Go here if you'd like to learn more. Taken directly from the ROBLOX Wiki 的利用:

Local parts are in no way supported by Roblox. They exploit unspecified replication behaviour - at any given moment, the development team could release an update that changes how Camera and Message instances behave, preventing you from making local parts.