Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why attemp to call table value?

script.Parent.MouseClick:Connect(function(g)
	for i,v in pairs( g.Backpack:GetChildren()) do
		if v.Name =="Key" then
			local t = game:GetService("TweenService")
			local goal = {}
			goal.Position = Vector3.new(workspace.Gate.Goal.Position.x,workspace.Gate.Goal.Position.y,workspace.Gate.Goal.Position.z)
			goal.Orieantation = Vector3.new(workspace.Gate.Goal.Orientation.X,workspace.Gate.Goal.Orientation.Y,workspace.Gate.Goal.Orientation.Z)
			t:Create(workspace.Gate.Gate,TweenInfo(2), goal):Play()
			script.Parent.MaxActivationDistance = 0
			wait(2)
			script.Parent.MaxActivationDistance =32 
		end
	end
end)

line 8 error, how table value?

1 answer

✓ Accepted answer

The reason this is happening is because at the line where you create the Tween, you use

TweenInfo(2)

TweenInfo is a table/class, you are trying to call a table value, you should use

TweenInfo.new(2)

This creates a TweenInfo with the time set to 2. This small typo errors your whole code. Also there is another typo, you use

goal.Orieantation

This will error the code because you spelled Orientation wrong and the game wouldn't find the property and then error, it should be

goal.Orientation

Here's your full script

script.Parent.MouseClick:Connect(function(g)
	for i,v in pairs( g.Backpack:GetChildren()) do
		if v.Name =="Key" then
			local t = game:GetService("TweenService")
			local goal = {}
			goal.Position = Vector3.new(workspace.Gate.Goal.Position.X,workspace.Gate.Goal.Position.Y,workspace.Gate.Goal.Position.Z)
			goal.Orientation = Vector3.new(workspace.Gate.Goal.Orientation.X,workspace.Gate.Goal.Orientation.Y,workspace.Gate.Goal.Orientation.Z)
			t:Create(workspace.Gate.Gate,TweenInfo.new(2), goal):Play()
			script.Parent.MaxActivationDistance = 0
			wait(2)
			script.Parent.MaxActivationDistance =32
		end
	end
end)

1 comment

0

oh

This discussion is preserved as it was. New answers, comments, and votes are closed.