Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does the gate rotate and not go down?

Asked by 4 years ago

Why does the gate rotate and not go down?

local Gate = game.Workspace.Castle.GATE
local TweenSevice = game:GetService("TweenService")

Gate.CFrame = CFrame.new(260.528, 121.642, 541.052)
Gate.Anchored = true

local goal = {}
goal.CFrame = CFrame.new(260.528, 108.642, 541.052)

local Time = 10
local DelayTime = 0

local tweenInfo = TweenInfo.new(
    Time,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    1,
    false,
    0
    )

local tween = TweenSevice:Create(Gate,tweenInfo,goal)

1 answer

Log in to vote
2
Answered by 4 years ago

For reference while you’re refactoring this, the way that I prefer to do things like animated gates and doors is:

Rig the door model with Motor6Ds (or Welds) to a “hinge part” at either end of the door, making it one rigid body, and allowing it to be rotated about that part easily. The hinge part should be anchored, and the rest of the model should be unanchored. connect a function to the touched event of the door (or however else you want it to open) which fires a message to all clients telling them to animate that door (I like to use TweenService to rotate the hinge part) lastly, you can also do simple client-side prediction by having the client that triggers the door animate it right away - however, that client now needs to ignore the message that will soon come from the server telling it to animate again. I recommend passing the player that triggered on the server to all clients, and then having the client ignore it if that player matches their local player minor correction: don’t use Welds for this

Ad

Answer this question