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

Line 16: Unable to cast to Dictionary? (fixed)

On line 16 I get the error "Unable to cast to Dictionary". I searched everywhere and found nothing. Please help.

tween = game:GetService("TweenService")
info1 = script.Parent.Door1END.Position
info1end = script.Parent.Door1.Position
info2 = script.Parent.Door2END.Position
info2end = script.Parent.Door2.Position
canopen = true

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		while char do
			wait(0.2)
			if (char.HumanoidRootPart.Position - script.Parent.Rad.Position).Magnitude <= 7 then
				if canopen then
					canopen = false
					script.Parent.Rad["Elevator Door Open"]:Play()
					local tw = tween:Create(script.Parent.Door1.Position, 1, info1)
					local tw2 = tween:Create(script.Parent.Door2.Position, 1, info2)
					script.Parent.Rad["Elevator Door Open"]:Stop()
				end
			end
			wait(0.2)
			if (char.HumanoidRootPart.Position - script.Parent.Rad.Position).Magnitude > 7 then
				if canopen == false then
					script.Parent.Rad["Elevator Close"]:Play()
					local tw = tween:Create(script.Parent.Door1.Position, 1, info1end)
					local tw2 = tween:Create(script.Parent.Door2.Position, 1, info2end)
					script.Parent.Rad["Elevator Close"]:Stop()
					canopen = true
				end
			end
		end
	end)
end)

1 answer

I figured it out myself fixed the error thanks

1 comment

0

Epic, tables to the rescue.

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