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

Entering PlayerGui from ReplicatedStorage?

Asked by 6 years ago

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.

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) HeadlessDeathSpeaker 9 — 6y
0
To enter the PlayerGui, simply do Player.PlayerGui. Local scripts will not do anything if they started off in workspace. LawlR 182 — 6y
0
I reanswered your question in the first thread. Rheines 661 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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.

Ad

Answer this question