Error TweenService:Create no property named 'GatePosition' for object 'MetalGate'

Hi other Developers,
I am relativity new to Roblox studio and I keep running across to this error and I don’t know how to fix it.

What do you want to achieve? I want to move the Metal Gate upwards with TweenService when the button is pressed (the Part varible)


This is the Error I keep getting ^^

This is the Current code i have:

–// Setting the Varibles for Instance Itself
local Part = script.Parent
local ClickDetector = Part:WaitForChild(“ClickDetector”)
local MetalGate = Part.Parent:WaitForChild(“MetalGate”)
local CoolDown = false
print(MetalGate)

–// Creating a movement animation for the door
local TweenService = game:GetService(“TweenService”)
local Info = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 1, true)
local GatePosition = MetalGate.Position
local NewGatePos = GatePosition + Vector3.new(0, 7, 0)

local NewPosition = {
GatePosition = NewGatePos
}

local MoveDoorUp = TweenService:Create(MetalGate, Info, NewPosition)

ClickDetector.MouseClick:Connect(function()
if CoolDown == false then
Part.Color = Color3.fromRGB(86, 255, 74)
task.wait(1)
MoveDoorUp:Play()
task.wait(3)
CoolDown = false
end
end)

Help would be very appreciated!

Replace GatePosition to Position. What you originally set the variable to was the Gate’s position at the time it was set. The argument requires the name of the property you want to set.

In the future, consider using “```” at the top and bottom of a code block to better format and read it.

local hey = "you're learning!"

Oh and, #help-and-feedback:scripting-support.

1 Like

Thank you I never knew this xd

1 Like

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