What do you want to achieve? Keep it simple and clear!
I am trying to create a platform that has two tweens that it goes back and fourth from, to make a platform that goes back and fourth from an island to another, similar to SuperTux’s famous Flying Propeller Platform.
What is the issue? Include screenshots / videos if possible!
I keep getting an error, and it is an error I don’t know how to fix. It keeps saying the “Position” property for these tweenservice goals are invalid, but I know they aren’t.
Here is the code:
local TweenInformation = TweenInfo.new(4,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1, false,0)
-- TWEEN ONE
local TweenGoal_One = {
Position = game.Workspace.Game.Map_Arena.Islands.Main_Island.PlatformWaypoints.Waypoint_Ruins.Position}
local TweenOne = game.TweenService:Create(script.Parent, TweenInformation, TweenGoal_One)
-- TWEEN TWO
local TweenGoal_Two = {
Position = game.Workspace.Game.Map_Arena.Islands.Main_Island.PlatformWaypoints.Waypoint_Main.Position}
local TweenTwo = game.TweenService:Create(script.Parent, TweenInformation, TweenGoal_Two)
while true do --Note: This basically stops your code, so nothing below it runs. Add the spawn() function to it like the example above if you don't want that.
TweenOne:Play()
TweenOne.Completed:Wait()
TweenTwo:Play()
TweenTwo.Completed:Wait()
end
And here is a screenshot of the error.
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I looked for solutions on the forums, but nothing popped up, so I decided to go to plan B. I tried using CFrame instead of Position as the property, but it still had the same error, thinking CFrame for the Platform part never existed.
Im trying to do this for fun, to make my game more popular. So far, I’m doing great in the entire remaster of the island arena. Please help if you can, it’d be appriciated!
Oh, I realized it now! Models don’t have a “Position” or “CFrame” property (to my understanding), so what you asked was if it was under the part or the model. It was under the model, and now I understand why it wasn’t working! Thank you!
My last question now would be:
Since it works, I’m trying to have the beam and propeller fly with it, only that they’re … staying in place? How do I FIX this to finally make THIS work?
Just tween the model like this (also set the PrimaryPart to something in the model):
local TweenService = game:GetService("TweenService")
local function CreateTweenForModel(Model: Model, TweenInfo: TweenInfo, GoalCFrame: CFrame): Tween
assert(Model.PrimaryPart, "MODEL DOES NOT HAVE A PRIMARYPART!!!!!!")
local CFrameValue = Instance.new("CFrameValue")
local Tween = TweenService:Create(CFrameValue, TweenInfo, {Value = GoalCFrame})
CFrameValue.Value = Model.PrimaryPart.CFrame
local Connection = CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
Model:PivotTo(CFrameValue.Value)
end)
Tween.Completed:Once(function()
Connection:Disconnect()
CFrameValue:Destroy()
end)
return Tween
end
CreateTweenForModel(Model, TweenInfo.new(bla bla bla), CFrame.new(1,1,1)):Play() -- Example
Now would this work with the two tweens I want it to iterate over?
No, it wouldn’t. The tween isn’t doing anything, and it’s just making the tween for the CFrame object. The model isn’t being used, so technically, it wouldn’t work, considering that the model isn’t being used anywhere else but the assert.
Although the model is being pivoted too the cframe value, it isn’t changing the position, meaning that the model doesn’t move, it just stays there, not doing anything.