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

Wont Show GUI?

Asked by 9 years ago

This is the Part that has an Error Output says"15:47:16.232 - ReplicatedStorage.RemoteEvent: OnClientEvent can only be used on the client"

event.OnClientEvent:connect(function(...)
    local tuple = {...}
    if tuple[1] == "Result" then
        if tuple[2] == "BloxxerWin" then
            resultname.Text = "Mad Bloxxer wins!"
            resultname.TextColor3 = Color3.new(1, 74/255, 77/255)
            resultdesc.Text = "All players were bloxxed."
        else
            resultname.Text = "Players win!"
            resultname.TextColor3 = Color3.new(111/255, 149/255, 1)
            resultdesc.Text = "All players were bloxxed."
        end
        resultprompt.Visible = true
        resultprompt.Position = UDim2.new(0, -400, .5, -92)
        resultprompt:TweenPosition(UDim2.new(.5, -170, .5, -92), "Out", "Quad", 1)
        wait(7)
        resultprompt:TweenPosition(UDim2.new(1, 60, .5, -92), "Out", "Quad", 1)
    elseif tuple[1] == "Class" then
        if tuple[2] == "Bloxxer" then
            classname.Text = "You are the Mad Bloxxer"
            classname.TextColor3 = Color3.new(1, 74/255, 77/255)
            classdesc.Text = "Your goal is to blox everyone!"
        end
        elseif tuple[2] == "Sheriff" then
            classname.Text = "You are the Sheriff"
            classname.TextColor3 = Color3.new(111/255, 149/255, 1)
            classdesc.Text = "Your goal is to find the Mad Bloxxer and put them away for good!"
        else
            classname.Text = "You are a Bystander"
            classname.TextColor3 = Color3.new(117/255, 1, 156/255)
            classdesc.Text = "Your goal is to help the Sheriff find the Mad Bloxxer."
        end
        classprompt.Visible = true
        classprompt.Position = UDim2.new(0, -400, .5, -92)
        classprompt:TweenPosition(UDim2.new(.5, -170, .5, -192), "Out", "Quad", 1)
        wait(7)
        classprompt:TweenPosition(UDim2.new(1, 60, .5, -92), "Out", "Quad", 1)
    end)

1 answer

Log in to vote
0
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

What is firing the RemoteEvent? It looks like this GUI script is in a server script, when it should be in a LocalScript.

1
I'm having the same problem, and I put it in a local script. Relatch 550 — 9y
0
You should be using OnServerEvent if it's in a server script, and OnClientEvent when it's in a local script. Obviously just putting the code in a local script wont work, because local scripts only run inside PlayerGui or Backpack. Perci1 4988 — 9y
Ad

Answer this question