I was just writing a script. Then I got this error, 'Unable to cast string to token.'
Here is my code, The Error was on line 18.
local p = script.Parent.Parent
local m = game.Players.LocalPlayer:GetMouse()
local db = script.Parent.Parent.value
db.Value = "false"
m.KeyDown:connect(function(k)
k = k:lower()
if k == "z" then
if (db.Value == "false") then
p.Enabled = true
local j = script.Parent
j:TweenPosition(
UDim2.new(1, 0,0.018, 0),
"Quad",
2,
true
)
local db = script.Parent.value
db.Value = "true"
elseif (db.Value =="true") then
local j = script.Parent
j:TweenPosition(
UDim2.new(0.261, 0,0.476, 0),
"In",
"Quad",
2,
true
)
p.Enabled = false
db.Value = "false"
end
end
end)
Any help would be greatly appreciated,
-Geo

3 comments
is "db" a StringValue or BoolValue?
It's clearly a string value. Also, I just recommend not using a value for the debounce, but rather a variable.
Also, please use UserInputService instead of Mouse.Keydown. Roblox doesn't recommend Mouse.KeyDown.