#LocalScript problems

1 messages · Page 1 of 1 (latest)

ebon aurora
#

script is too long to sendevilcat

vast compass
#

pastebin or github

ebon aurora
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GuessEvent = ReplicatedStorage:WaitForChild("ArtistGameRemotes"):WaitForChild("GuessEvent")

local gameFrame = script.Parent
local guessInput = gameFrame:WaitForChild("GuessInput")
local feedbackListFrame = gameFrame:WaitForChild("FeedbackListFrame")

local guessCount = 0

local colors = {
    ["Correct"] = Color3.fromRGB(0, 200, 0),
    ["Close"] = Color3.fromRGB(255, 170, 0),
    ["Close - Higher"] = Color3.fromRGB(255, 200, 0),
    ["Close - Lower"] = Color3.fromRGB(255, 200, 0),
    ["Incorrect"] = Color3.fromRGB(200, 0, 0),
    ["No Match"] = Color3.fromRGB(100, 100, 100)
}

-- SUBMIT ON ENTER KEY PRESS
guessInput.FocusLost:Connect(function(enterPressed)
    if enterPressed then
        local guess = guessInput.Text
        if guess ~= "" then
            print("Sending guess:", guess)
            GuessEvent:FireServer(guess)
            guessInput.Text = ""
        end
    end
end)
#
GuessEvent.OnClientEvent:Connect(function(data)
    if data.Error then
        warn("Guess error:", data.Error)
        return
    end

    if data.Feedback then
        guessCount += 1

        local guessFrame = Instance.new("Frame")
        guessFrame.Size = UDim2.new(1, 0, 0, 140)
        guessFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
        guessFrame.BorderSizePixel = 0
        guessFrame.LayoutOrder = -guessCount
        guessFrame.Parent = feedbackListFrame

        local title = Instance.new("TextLabel")
        title.Size = UDim2.new(1, 0, 0, 20)
        title.Text = "Guess #" .. guessCount .. ": " .. data.GuessName
        title.BackgroundTransparency = 1
        title.TextColor3 = Color3.new(1,1,1)
        title.Font = Enum.Font.SourceSansBold
        title.TextSize = 18
        title.Parent = guessFrame

        local categories = {"Debut", "Popularity", "Members", "Genre", "Country", "Gender"}

        local y = 25
        for _, cat in ipairs(categories) do
            local box = Instance.new("Frame")
            box.Size = UDim2.new(1, -10, 0, 18)
            box.Position = UDim2.new(0, 5, 0, y)
            box.BackgroundColor3 = colors[data.Feedback[cat]] or Color3.fromRGB(60,60,60)
            box.BorderSizePixel = 0
            box.Parent = guessFrame

            local label = Instance.new("TextLabel")
            label.Size = UDim2.new(1, 0, 1, 0)
            label.BackgroundTransparency = 1
            label.Text = cat .. ": " .. data.Feedback[cat]
            label.TextColor3 = Color3.new(1,1,1)
            label.Font = Enum.Font.SourceSans
            label.TextSize = 14
            label.TextXAlignment = Enum.TextXAlignment.Left
            label.Parent = box

            y += 20
        end
    end
end)