how do i turn this into a script were if you click a button then the part will go up until it hits a certain part then it stop but if the player clicks the other button it will either stop or go down depending if the elevator goes up or not.
local elevator = script.Parent.Parent.elevatorpart
local button = script.Parent
local clickdetector = script.Parent.ClickDetector
local button2 = script.Parent.Parent.down.ClickDetector
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5,Enum.EasingStyle.Linear ,Enum.EasingDirection.In)--(Time, EasingSyle,EasingDirection)
local part = script.Parent
local propertyTable = {Position = Vector3.new(-8.715, 40.5, -3.855)}--It will move to that position
local Tween = tweenService:Create(part,tweenInfo,propertyTable)
Tween:Play()
Yes, that would work, but you’d have to implement that into a tween, otherwise the elevator will just teleport up without keeping the players inside of it.
You can just add number to Y axis and try to get the perfect number:
local part = script.Parent
local goal = Vector3.new(part.Position.X,part.Position.Y + 20 ,part.Position.Z)--Change number 20
--------or
local goal = script.Parent.Position + Vector3.new(0,20,0)
local a = script.Parent.Position + Vector3.new(0,4,4)
print(a) -- It will print with no error
local p = script.Parent.Position + (4,4,4)
print(p) -- Error
Please do not use Tween Service, it’s just not good, either makes sense, and it would causes trouble like glitching and more.
use prismatic constraists
elevator.position = vector3.new(-- number example)
elevator.position = vector3.new(-- number example)
elevator.position = vector3.new(-- number example)
elevator.position = vector3.new(-- number example)
elevator.position = vector3.new(-- number example)
the elevator went somewere but i don’t know were all i know is it did not go up robloxapp-20200804-1350240.wmv (1.1 MB)
local elevator = script.Parent.Parent.elevatorpart
local button = script.Parent
local clickdetector = script.Parent.ClickDetector
local button2 = script.Parent.Parent.down.ClickDetector
clickdetector.MouseClick:Connect(function()
local goal = 90
for i = 1, goal, 0.5 do
elevator.Position = elevator.Position + Vector3.new(0,i,0)
end
end)