NOTICE
Not sure if this is the correct category, if it is let me know and I’ll spend a few hours trying to figure out how to move the post.
What do you want to achieve?
I am trying to achieve an angular elevator where it moves up and horizontally at the same time.
What is the issue?
I’m not sure exactly how to do this as I’m unsure on how I get it to stay in position, I’ve got the movement up and horizontally but it doesn’t stay on the rails.
What solutions have you tried so far?
I’ve tried using body velocities to move it up and horizontally, but this gets it done although it doesn’t stay on the rails
You should probably try using TweenService since it will allow you to precisely set the start and end of the path. You should put parts to mark start and end, and make the elevator’s primary part move to these.
IIRC, I used a PrismaticConstraint and had two points in an elevator design similar to yours and it seems to hold pretty well for my part, physics-wise. PrismaticConstraints were able to keep my character on the platform for the majority of the ride (but doesn’t hold them well without setting the network ownership) and keep the platform locked in place.
Still, there may be a better alternative than how I approached this.
This script is supposed to be able to make players move with the object when it moves. Ive seen a video oh it running pretty smoothly. Also, im not sure if this works on a regular script or a local script im pretty sure you need a local script tho and then put it in server script service. if that doesnt work then use the regular script. oh and also for the parts where notes are placed those things tell you what you need to change in the script for it to work on you object. in this case you are using an elevator so change the part where it says RaftTop in quotation marks and change it to whatever you elevator is named. and also there is a c frame part and some other things later in the script, but im not sure how they work. maybe if a scripter is seeing this they can help.
EDIT: Oh yea and also the part where you put the name of your object in the string its not the whole object its just the part where the player stands in the elevator. So yours is probably the floor of the elevator thats the part which needs to be in the quotation marks.
Here is the script:
local Players = game:GetService("Players")
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local LastTrainCFrame
local Function
local Function2
Function = RunService.Heartbeat:Connect(function()
--------------------------------------------------------------- CHECK PLATFORM BELOW
local RootPart = player.Character.LowerTorso
local Ignore = player.Character
local ray = Ray.new(RootPart.CFrame.p,Vector3.new(0,-50,0))
local Hit, Position, Normal, Material = workspace:FindPartOnRay(ray,Ignore)
if Hit and Hit.Name == "RaftTop" then -- Change "RaftTop" to whatever the moving part's name is
--------------------------------------------------------------- MOVE PLAYER TO NEW POSITON FROM OLD POSITION
local Train = Hit
if LastTrainCFrame == nil then -- If no LastTrainCFrame exists, make one!
LastTrainCFrame = Train.CFrame -- This is updated later.
end
local TrainCF = Train.CFrame
local Rel = TrainCF * LastTrainCFrame:inverse()
LastTrainCFrame = Train.CFrame -- Updated here.
RootPart.CFrame = Rel * RootPart.CFrame -- Set the player's CFrame
--print("set")
else
LastTrainCFrame = nil -- Clear the value when the player gets off.
end
Function2 = player.Character.Humanoid.Died:Connect(function()
Function:Disconnect() -- Stop memory leaks
Function2:Disconnect() -- Stop memory leaks
end)
end)
Hey, I’ve tried this and I’m not sure exactly what to do, I looked at the tutorial on how to use PrismaticConstraints but not sure how to do it on an angle.
I’ve tried; Facing Front On the rails(this goes… crazy) ^ The way it’s set up
Thanks for the help.
The second link you provided is on the right track, assuming you had rotated the attachments to be parallel with the rails. Though with the elevator flying up at the end, you might want to turn on LimitsEnabled in the PrismaticConstraint and set the upper/lower limits accordingly which will prevent the elevator from moving beyond where it’s supposed to be.
Unless it was something else then I don’t know where to go from there.
Another thing I forgot to mention is that if you find players/objects falling off during the ride, you could add invisible walls and in a script that sets their CanCollide property on during the ride and off when it’s not moving.
I got it working, turns out the issue was with my BodyPosition and BodyGyro, not sure why but I removed them and it works a charm. Thank you very much! ^w^