Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with gui changing script? [ANSWERED]

Asked by 8 years ago

So, I had a post earlier about a card reader, I fixed a lot of that but it now gives another error at the output. error: 02:51:22.646 - Workspace.Model.Script:84: attempt to call a userdata value now, here is line 84 and line 1, 2 and 3.

model = script.Parent
reader = model.CardReader
cardcolor = model.CardReader.SurfaceGui.Colory

cardcolor.BackgroundColor3=Color3.new()(0,85,0)      --the error is at this part

and if you need the whole script,

model = script.Parent
reader = model.CardReader
Menu = model.Menu
keys = Menu.SurfaceGui.Keys
n1 = keys.n1
n2 = keys.n2
n3 = keys.n3
n4 = keys.n4
n5 = keys.n5
n6 = keys.n6
n7 = keys.n7
n8 = keys.n8
n9 = keys.n9
clear = keys.Clear
back = keys.Back
enter = keys.Enter
code = model.LDCode
i = model.Input
Lockdown = model.Lockdown
plyrinfo = Menu.SurfaceGui.Info
cardinfo = reader.SurfaceGui.Info
cardcolor = reader.SurfaceGui.Colory
lvl = model.NeedLVL
divisiont = model.DIVISIONTrue
Division = model.DIVISION
HRLVL = model.HRLVL
state = model.State
local db = false 

i.Value = ""

enter.MouseButton1Down:connect(function()
    if i.Value == code.Value then
        Lockdown.Value = not Lockdown.Value
        enter.Text = "CORRECT CODE"
        wait(.75)
        enter.Text = "ENTER"
        i.Value = ""
    elseif i.Value ~= code.Value then
        enter.Text = "INCORRECT CODE"
        wait(.75)
        enter.Text = "ENTER"
        i.Value = ""    
    end
end)

n1.MouseButton1Down:connect(function() i.Value = i.Value.."1" end)
n2.MouseButton1Down:connect(function() i.Value = i.Value.."2" end)
n3.MouseButton1Down:connect(function() i.Value = i.Value.."3" end)
n4.MouseButton1Down:connect(function() i.Value = i.Value.."4" end)
n5.MouseButton1Down:connect(function() i.Value = i.Value.."5" end)
n6.MouseButton1Down:connect(function() i.Value = i.Value.."6" end)
n7.MouseButton1Down:connect(function() i.Value = i.Value.."7" end)
n8.MouseButton1Down:connect(function() i.Value = i.Value.."8" end)
n9.MouseButton1Down:connect(function() i.Value = i.Value.."9" end)
clear.MouseButton1Down:connect(function() i.Value = "" end)

back.MouseButton1Down:connect(function()
    Menu.SurfaceGui.Keys.Visible = false
    Menu.SurfaceGui.Alarm.Visible = true
    Menu.SurfaceGui.Lockdown.Visible = true
end)

Menu.SurfaceGui.Lockdown.MouseButton1Down:connect(function()
    Menu.SurfaceGui.Keys.Visible = true
    Menu.SurfaceGui.Alarm.Visible = false
    Menu.SurfaceGui.Lockdown.Visible = false
end)

reader.Touched:connect(function(thing)
    if thing.Parent.ClassName ~= "Tool" then 
    else
    if thing.Parent:findFirstChild("level") == nil then
    else
    if divisiont.Value == false then
        if (thing.Parent:findFirstChild("level").Value <= lvl.Value - 1) then
        cardcolor.BackgroundColor3=Color3.new(170,0,0)
        cardinfo.Screen.Text = "ACCES DENIED"
        wait(1)
        cardcolor.BackgroundColor3=Color3.new(117,117,117)
        cardinfo.Screen.Text = "Insert card"
        else
            if state.Value == 1 then --open
            cardcolor.BackgroundColor3=Color3.new()(0,85,0)
            cardinfo.Screen.Text = "ACCESS GRANTED"
            local namet = thing.Parent:findFirstChild("name")
            local rankt = thing.Parent:findFirstChild("rank")
            plyrinfo.name.Text = namet.Value
            plyrinfo.rank.Text = rankt.Value
            plyrinfo.level.Text = "LEVEL".. thingo.Value
            plyrinfo.Visible = true
            wait(0.25)
            cardcolor.BackgroundColor3=Color3.new(117,117,117)
            cardinfo.Screen.Text = "Insert card"
            plyrinfo.Visible = false
            plyrinfo.name.Text = ""
            plyrinfo.rank.Text = ""
            plyrinfo.level.Text = ""
            elseif state.Value == 3 then --close
            cardcolor.BackgroundColor3=Color3.new(0,85,0)
            cardinfo.Screen.Text = "ACCESS GRANTED"
            local namet = thing.Parent:findFirstChild("name")
            local rankt = thing.Parent:findFirstChild("rank")
            plyrinfo.name.Text = namet.Value
            plyrinfo.rank.Text = rankt.Value
            plyrinfo.level.Text = "LEVEL".. thingo.Value
            plyrinfo.Visible = true
            wait(0.25)
            cardcolor.BackgroundColor3=Color3.new(117,117,117)
            cardinfo.Screen.Text = "Insert card"
            plyrinfo.Visible = false
            plyrinfo.name.Text = ""
            plyrinfo.rank.Text = ""
            plyrinfo.level.Text = ""
            elseif state.Value == 2 then

            end
        end
    elseif divisiont.Value == true then
        if thing.Parent:findFirstChild(Division.Value) or (thing.Parent:findFirstChild("level").Value >= HRLVL.Value) then
            if state.Value == 1 then --open
            cardcolor.BackgroundColor3=Color3.new(0,85,0)
            cardinfo.Screen.Text = "ACCESS GRANTED"
            local namet = thing.Parent:findFirstChild("name")
            local rankt = thing.Parent:findFirstChild("rank")
            plyrinfo.name.Text = namet.Value
            plyrinfo.rank.Text = rankt.Value
            plyrinfo.level.Text = "LEVEL".. thingo.Value
            plyrinfo.Visible = true
            wait(0.25)
            cardcolor.BackgroundColor3=Color3.new(117,117,117)
            cardinfo.Screen.Text = "Insert card"
            plyrinfo.Visible = false
            plyrinfo.name.Text = ""
            plyrinfo.rank.Text = ""
            plyrinfo.level.Text = ""
            elseif state.Value == 3 then --close
            cardcolor.BackgroundColor3=Color3.new(0,85,0)
            cardinfo.Screen.Text = "ACCESS GRANTED"
            local namet = thing.Parent:findFirstChild("name")
            local rankt = thing.Parent:findFirstChild("rank")
            plyrinfo.name.Text = namet.Value
            plyrinfo.rank.Text = rankt.Value
            plyrinfo.level.Text = "LEVEL".. thingo.Value
            plyrinfo.Visible = true
            wait(0.25)
            cardcolor.BackgroundColor3=Color3.new(117,117,117)
            cardinfo.Screen.Text = "Insert card"
            plyrinfo.Visible = false
            plyrinfo.name.Text = ""
            plyrinfo.rank.Text = ""
            plyrinfo.level.Text = ""
            elseif state.Value == 2 then

            end
        else
        cardcolor.BackgroundColor3=Color3.new(170,0,0)
        cardinfo.Screen.Text = "ACCES DENIED"
        wait(1)
        cardcolor.BackgroundColor3=Color3.new(117,117,117)
        cardinfo.Screen.Text = "Insert card"
        end
    end
    end
    end
end)

I hope one of you can help with this problem, its the part under reader.Touched

-edit, I fixed it myself, I had () 2 times

1 answer

Log in to vote
0
Answered by 8 years ago

fixed it myself, I had () 2 times

0
Lol this made me laugh (No offense XD) SamTheDeveloper 85 — 8y
Ad

Answer this question