Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TweenService gives me error about a type mismatch?

Asked by 5 years ago
Edited 5 years ago
01local Ship = script.Parent
02local Nodes = workspace.ShipNodes
03local ShipNodes = workspace.ShipNodes:GetChildren()
04 
05local tweenService = game:GetService("TweenService")
06local info = TweenInfo.new()
07 
08local function tweenModel(model, CF)
09    local CFrameValue = Instance.new("CFrameValue")
10    CFrameValue.Value = model:GetPrimaryPartCFrame()
11 
12    CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
13        model:SetPrimaryPartCFrame(CFrameValue.Value)
14    end)
15 
View all 30 lines...

**** 22:36:59.450 - TweenService:Create property named 'Value' cannot be tweened due to type mismatch (property is a 'CoordinateFrame', but given type is 'Instance') 22:36:59.451 - Stack Begin 22:36:59.452 - Script 'Workspace.Ship.Script', Line 17 - local tweenModel 22:36:59.452 - Script 'Workspace.Ship.Script', Line 28 22:36:59.452 - Stack End****

0
Line 17: local tween = tweenService:Create(CFrameValue, info, {Value = CF}) TheDev321 37 — 5y
0
Line 28: tweenModel(Ship, Nodes:FindFirstChild("Node" .. i)) TheDev321 37 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Looks like you cannot tween a CFrameValue, you can use a part in nil and then CFrame it, then make the model follow it

01local Ship = script.Parent
02local Nodes = workspace.ShipNodes
03local ShipNodes = workspace.ShipNodes:GetChildren()
04 
05local tweenService = game:GetService("TweenService")
06local infoArray = {
071, --// Duration of the tween
08Enum.EasingStyle.Style, --// style
09Enum.EasingDirection.In, --// Easing Direction
10false,
110,
12false
13} --// Info
14 
15local info = TweenInfo.new(unpack(infoArray))
View all 39 lines...

What we basically do is make a part and Tween it, and listen for every time its CFrame changes, so the model follows it.

If this answered your question mark it as the answer!

0
19:06:54.706 - TweenService:Create property named 'CFrame' cannot be tweened due to type mismatch (property is a 'CoordinateFrame', but given type is 'Instance') 19:06:54.706 - Stack Begin 19:06:54.707 - Script 'Workspace.Ship.Script', Line 26 - local tweenModel 19:06:54.707 - Script 'Workspace.Ship.Script', Line 37 19:06:54.707 - Stack End TheDev321 37 — 5y
0
use tweenModel(Ship, Nodes:FindFirstChild("Node" .. i).CFrame) instead maumaumaumaumaumua 628 — 5y
Ad

Answer this question