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.
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)