Im trying to make a code to move a part from one platform to another on actuation by a proximity prompt.
I believe i made it right but it seems to not be working. This is my code:
local model = script.Parent
local movingpart = model.Part
local button1 = model.Button1
local button2 = model.Button2
local promt1 = model.Button1.Attachment.ProximityPrompt
local promt2 = model.Button2.Attachment.ProximityPrompt
local tweeninfo=TweenInfo.new(4)
local partgoing = {}
partgoing.CFrame = movingpart.CFrame * CFrame.new(movingpart.Size*7,0,0)
local tweengoing = TweenService:Create(promt1, tweeninfo,partgoing)
local partcoming = {}
partcoming.CFrame = movingpart.CFrame
local tweencoming = TweenService:Create(promt2, tweeninfo,partcoming)
promt1.Triggered:Connect(function()
tweengoing:Play()
end)
promt2.Triggered:Connect(function()
tweencoming:Play()
end)
Please inform me what mistakes ive made, how to fix them, and explanation on how your fix works.
Thanks
Porus