Need help with my Module Scipt

local doorConfig = {}


function doorConfig.Animate(Part, Action)
	local TweenService = game:GetService("TweenService")
	local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
	
	local OpenGoal = Part.CFrame * CFrame.Angles(0,math.rad(-110),0)
	local CloseGoal = Part.CFrame * CFrame.Angles(0,0,0)
	
	local OpenAnimation = TweenService:Create(Part, tweenInfo, OpenGoal)
	local CloseAnimation = TweenService:Create(Part, tweenInfo, CloseGoal)
	
	if Action == "Open" then
		OpenAnimation:Play()
	elseif Action == "Close" then
		CloseAnimation:Play()
	end
end

return doorConfig

Getting this error

 17:26:18.479  Unable to cast to Dictionary  -  Server - DoorConfig:13
  17:26:18.479  Stack Begin  -  Studio
  17:26:18.479  Script 'ReplicatedStorage.Configs.DoorConfig', Line 13 - function Animate  -  Studio - DoorConfig:13
  17:26:18.479  Script 'Workspace.Door_Model.Script', Line 10  -  Studio - Script:10
  17:26:18.479  Stack End  -  Studio

Server-Sided script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Door = script.Parent
local Hinge = Door.Hinge 
local Configs = ReplicatedStorage:WaitForChild("Configs")

local DoorConfig = require(Configs.DoorConfig)


wait(2)
DoorConfig.Animate(Hinge, "Open")
wait(5)
DoorConfig.Animate(Hinge, "Close")

I need help fixing it please

The Goal of the Tween needs to be a table with a Property Assigned inside of it.

{} -- this is a table, it can hold values inside of it
{CFrame} -- inside here is the index, which is the name of our Property
{CFrame = value} -- Tween will try to Interpolate towards this value using "Property"

{CFrame = Part.CFrame * CFrame.Angles(0,math.rad(-110),0)}
{CFrame = Part.CFrame}

Thank you so much.
Read that but didnt know if it would work but it did

@DasKairo Now the door wont close when opened at a 110 degress angle

Oh I see, You can probably have the CFrame be applied like this:

{CFrame = CFrame.new(Part.Position)}
-- There is no Orientation Given, So it should revert back to 0,0,0

Brilliant Thank you for both of the Scripts

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.