I’m trying to figure out how to make a player move with a part whenever they are stepping on it. Here’s the code I am using to make the part move.
function StageModule.ActivateRaisingParts(checkpointFolder, raisingpartFolder)
for j, raisingpart in pairs(raisingpartFolder:GetChildren()) do
local goal = {}
goal.CFrame = raisingpart.CFrame + Vector3.new(0,15,0)
local goal2 = {}
goal2.CFrame = raisingpart.CFrame + Vector3.new(0,-15,0)
local goal3 = {}
goal3.CFrame = raisingpart.CFrame + Vector3.new(0,0,-20)
local goal4 = {}
goal4.CFrame = raisingpart.CFrame + Vector3.new(0,0,20)
local goal5 = {}
goal5.CFrame = raisingpart.CFrame + Vector3.new(0,0,-25)
local goal6 = {}
goal6.CFrame = raisingpart.CFrame + Vector3.new(0,0,25)
local goal7 = {}
goal7.CFrame = raisingpart.CFrame + Vector3.new(0,0,-60)
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 0)
local tweenInfo2 = TweenInfo.new(6, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 0)
local tween = TweenService:Create(raisingpart, tweenInfo, goal)
local tween2 = TweenService:Create(raisingpart, tweenInfo, goal2)
local tween3 = TweenService:Create(raisingpart, tweenInfo, goal3)
local tween4 = TweenService:Create(raisingpart, tweenInfo, goal4)
local tween5 = TweenService:Create(raisingpart, tweenInfo, goal5)
local tween6 = TweenService:Create(raisingpart, tweenInfo, goal6)
local tween7 = TweenService:Create(raisingpart, tweenInfo2, goal7)
if raisingpart.Name == "1" then
tween:Play()
elseif raisingpart.Name == "2" then
tween2:Play()
elseif raisingpart.Name == "3" then
tween3:Play()
elseif raisingpart.Name == "4" then
tween4:Play()
elseif raisingpart.Name == "5" then
tween5:Play()
elseif raisingpart.Name == "6" then
tween6:Play()
elseif raisingpart.Name == "7" then
tween7:Play()
end
end
end
Can anyone help me out with this one?