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

Unable To Cast To Dictionary?

Hi I Have This Error In My Code I Literally Makes No Sense I Know What A Dictionary Is In Roblox. But This Should Work But I Guess Not. The Code is In A Script. And The error is at line 13

local TweenService = game:GetService("TweenService")
local door = script.Parent.Parent.Safety.Door
local tweeninformation = TweenInfo.new(
  3,
  Enum.EasingStyle.Linear,
  Enum.EasingDirection.In,
  0,
  false,
  0	
)
local doorclose = CFrame.new(-247.7, -55, 126.6)
local dooropen =  CFrame.new(-247.7, -55, 125.6)
local openanim = TweenService:Create(door,tweeninformation,dooropen)
local closeanim = TweenService:Create(door,tweeninformation,doorclose)

-- door cmd
script.Parent.DoorOpen.Open.ClickDetector.MouseClick:Connect(function()
	print("Opening Vibe Check Door")
	openanim:Play()
end)
script.Parent.DoorOpen.Close.ClickDetector.MouseClick:Connect(function()
	closeanim:Play()
end)
-- laser vars
local laser1 = script.Parent.Parent.LaserChecker1
local laser2 =  script.Parent.Parent.LaserChecker2
local laser3 = script.Parent.Parent.LaserChecker3
local VibeRandom = {"Good Vibes Detected","Bad Vibes Detected"}
-- laser start
script.Parent.Lasers.Start.ClickDetector.MouseClick:Connect(function()
	print("RunningLaser")
	laser1.Laser.Transparency = 0
	laser2.Laser.Transparency = 0
	laser3.Laser.Transparency = 0
	wait(5)
	laser1.TopPart2.Smoke.Enabled = true 
	laser2.TopPart2.Smoke.Enabled = true
	laser3.TopPart2.Smoke.Enabled = true
	wait(25)
	laser1.Laser.Transparency = 0
	laser2.Laser.Transparency = 0
	laser3.Laser.Transparency = 0
	laser1.TopPart2.Smoke.Enabled = false
	laser2.TopPart2.Smoke.Enabled = false
	laser3.TopPart2.Smoke.Enabled = false
	wait(1)
	script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.Text = VibeRandom[math.random(1,#VibeRandom)]
end)
-- vibe results
local TrapThing = workspace.Map.Final.VibeCheck.VibeRoom.Build.Floor
local TrapBackPos = CFrame.new(-306.7, -61.5, 145.8)
local TrapClosePos = CFrame.new(-267.7, -61.5, 145.8)
local TrapClose = Tweenservice:Create(TrapThing,tweeninformation,TrapClosePos)
local TrapOpen = Tweenservice:Create(TrapThing,tweeninformation,TrapBackPos)



script.Parent.VibeResults.Exucute.ClickDetector.MouseClick:Connect(function()
	print("Trying To Execute")
	if script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.Text == "Good Vibes Detected" then
		script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.Text = "ERR:GOOD VIBES"
		script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.TextColor3 = Color3.new(255, 0, 0)
		wait(2)
		script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.Text = ""
		script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.TextColor3 = Color3.new(255, 255, 255)
	else
		script.Parent.VibeResults.Monitor.SurfaceGui.TextLabel.Text = "Executing"
		TrapOpen:Play()
		workspace.Map.Final.VibeCheck.VibeRoom.Chair.Parent = game.ReplicatedStorage
		wait(5)
		TrapClose:Play()
		workspace.Map.Final.VibeCheck.VibeRoom.Chair.Parent = workspace.Map.Final.VibeCheck.VibeRoom
	end
end)

Please Leave You Suggestions In The Comments!

1 answer

✓ Accepted answer

I think the problem is that when you are setting the dooropen and doorclose variables, you don't name the property that is supposed to be changed you only set the CFrame values, since tweening require that you mention the property that is going to be changed. I think the solution to this is doing:

local doorclose = {CFrame = CFrame.new(-247.7,-55,126.6)}
local dooropen = {CFrame = CFrame.new(-247.7,-55,125.6)}

Then I think it should work.

2 comments

0

Thanks For The Help! I Just Forgot To Put Braces And CFrame = CFrame.new

0

Np

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