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

Accessing PlayerGui Through ServerScript?

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

✓ Accepted answer

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!

1 comment

0

Thank you!

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