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

This RemoteEvent isn't working on a Local Server. Am I doing something wrong?

Asked by 6 years ago

I want to make it so when you click Play, it'll Destroy the Play Button,Title and Blur. I also want it to make my black TextLabel visible aswell as playing rain effects. It gives me no error, and it works in Studio, but not the local server(game). Here is my scripting's screenshots and scripting itself.

Screenshots : https://i.gyazo.com/db6a2aec8b5e43d6596ff9b60e8add99.png AND https://i.gyazo.com/7992f4ab253a952658a9b758979f867e.png

Scripting :

LocalScript in Play Button :

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.Play:FireServer()
end)

Script in ServerScriptService :

game.ReplicatedStorage.Play.OnServerEvent:Connect(function()
    for i,v in pairs(game.Players:GetPlayers()) do
        v.PlayerGui.StartGui.Title:Destroy()
        v.PlayerGui.Intro.Background.Visible = true
        v.PlayerGui.StartGui.Play:Destroy()
        game.Lighting.Blur:Destroy()
        game.ServerStorage.IntroRain:Play()
    end
end)

Please let me know what I am doing wrong.

I am new to RemoteEvents so if it's a simple fix, I'd love if you gave a brief explanation of how you fixed it(optional)

~ Thanks, TheOnlySmarts.

1 answer

Log in to vote
0
Answered by
Axdrei 107
6 years ago
Edited 6 years ago

I am pretty sure you can't access PlayerGui from Server. Using a RemoteEvent in your case won't work, because 1. It would destroy "Blur" from Lighting for everyone (after YOU clicked play) 2. It would play "IntroRain" for everyone (after YOU clicked play)

I suggest making everything locally, for an intro gui.

local Lighting = game:GetService("Lighting")
local Blur = Lighting:WaitForChild("Blur")
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local StartGui = PlayerGui:WaitForChild("StartGui"
local Intro = PlayerGui:WaitForChild("Intro")

script.Parent.MouseButton1Click:Connect(function()
    StartGui.Title:Destroy()
    Intro.Background.Visible = true
    StartGui.Play:Destroy()
    Blur:Destroy()
end)
0
Thanks for the answer but I realised I don't need a remoteEvent for this part since this is a 1 player game only, I did accept your thing though becuz if it was like a 6 player game, then this would help, thx TheOnlySmarts 233 — 6y
Ad

Answer this question