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

Accessing PlayerGui Through ServerScript?

Asked by
xEiffel 280 Moderation Voter
6 years ago

I know that it requires Remote Events/Functions, but what one would I use? I want it so that when you hit something, It will pop up a GUI which I already have, the server script inside the button says ;

local ListenToGameEvent = game.ReplicatedStorage.Events

script.Parent.Touched:Connect(function(Receiver)
    if Receiver.Parent:FindFirstChildOfClass("Humanoid") then
        if script.Parent.Parent.Parent.Owned.Value ~= true then 
            -- Questionable Remote for ...Client()
        end
    end
end)

and What i've tried from so far it wont work if i call it and say the Client it will only work in a LocalScript, and It will only recieve it from a script so the showing in the ScreenGui in PlayerGui wont appear. Any help?

1 answer

Log in to vote
0
Answered by 6 years ago

Your script is fine here, you need to have a small change where it says -- Questionable Remote for ...Client()

local ListenToGameEvent = game.ReplicatedStorage.Events

script.Parent.Touched:Connect(function(Receiver)
    if Receiver.Parent:FindFirstChildOfClass("Humanoid") then
        if script.Parent.Parent.Parent.Owned.Value ~= true then
            ListenToGameEvent:FireClient(player, --any arguements)
        end
    end
end)

Then in a LocalScript in StarterPlayer you need to include this:

game.ReplicatedStorage.Events.OnClientEvent:Connect(function()
--rest of code that makes GUI show up

Hope that helps!

0
Thank you! xEiffel 280 — 6y
Ad

Answer this question