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

Help with Event?

Asked by 8 years ago
scoreevent.OnClientEvent:connect(function(...)
    local tuple = {...}
    if tuple[1] == "Deathmatch" then
        print(tuple[2])
        if tuple[2] == "Really blue" then
            print("1")
        end
    end
end)

For some reason where it has print(tuple[2]) it prints "Really blue", but when it asks if tuple[2] == "Really blue" then it doesn't print("1"), and I can't get why. Please help.

function newcharacter(murderedplayer, character)
    local humanoid = character:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.Died:connect(function()
            if character.Humanoid:FindFirstChild("creator") then
                local tag = character.Humanoid.creator
                local killer = tag.Value
                scoreevent:FireAllClients("Deathmatch", killer:WaitForChild("PlayerStats").Team.Value)
            end
        end)
    end
end
0
Can you show us the arguments you're passing to this remote call? ScriptGuider 5640 — 8y
0
Editted NinjoOnline 1146 — 8y

1 answer

Log in to vote
2
Answered by
RafDev 109
8 years ago

From what I understood, that value is a BrickColor value, thus tuple[2] will not be the string "Really blue", but the BrickColor "Really blue". When you print it, the internal print function will call tostring on it, and print the string "Really blue", but when you compare the BrickColor with the string, it is not the same.

So, instead of:

if tuple[2] == "Really blue" then

You can use:

if tuple[2] == BrickColor.new("Really blue") then

Hope it helps! :) Please comment if you don't understand.

0
OMG I forgot it was a BrickColor Value!! Thank you so much!! NinjoOnline 1146 — 8y
0
No problem! RafDev 109 — 8y
Ad

Answer this question