Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Entering PlayerGui from ReplicatedStorage?

So, someone here helped me making a script. (See below)

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")

local player = Players.LocalPlayer

local remote = RS:WaitForChild("RemoteEvent")

--Where the sound is located.
local sound = --location of your sound here relative to your script.

local function PlaySound()
    sound:Play()
end

--Listen for events from the server.
remote.OnClientEvent:Connect(PlaySound)

I'm really thankfull! But, i don't know how to enter the PlayerGui (Containing Sounds. Want u use a LocalSoundScript that gets activated from a Brick) trough ReplicatedStorage,

I asked him the same question, but i think he's in a different time-zone that i am, so he's probably sleeping :P.

3 comments

0

(EDIT: The script above is placed in a LocalScript in ReplicatedStorage. The script that triggers this script, is a LocalScript in a brick in Workspace)

0

To enter the PlayerGui, simply do Player.PlayerGui. Local scripts will not do anything if they started off in workspace.

0

I reanswered your question in the first thread.

1 answer

It's pretty simple. Like that:

--< Services
local PlayerService = game:GetService('Players')
local RStorageService = game:GetService('ReplicatedStorage')

--< Client
local Player = PlayerService.LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')

--< Variables
local RemoteEvent = RStorageService:WaitForChild('RemoteEvent')
local Sound = ... -- Location of your sound here relative to your script.

--< Events
RemoteEvent.OnClientEvent:Connect(function() -- Listen for events from the server.
    -- Your code
end)

Use the roblox developper site to found information. Like that page who is talking about PlayerGui

Solved your question? put in title [SOLVED] or accept a answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.