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

I can't make a gui appearwho pressed a button through local and server scripts what do I do?

Okay, so basically what I want to do is make a gui appear as soon as you press a model's button which has a click detector, however for this I need to make a local script and server script communicate with remotefired but whenever I join the game it automatically enables the GUI for all please help. This is the server script:

function onClicked()
	script.Parent.Parent.LOUD1.BrickColor = BrickColor.new("Black")
	script.Parent.Parent.LOUD2.BrickColor = BrickColor.new("Black")
	script.Parent.Parent.LOUD3.BrickColor = BrickColor.new("Black")
	script.Parent.Parent.Union2.Smoke.Enabled = true
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)
	
local hiEvent = Instance.new("RemoteEvent")
    hiEvent.Parent = game.ReplicatedStorage
    hiEvent.Name = "hiEvent"

local function onPlayerAdded(player)
	hiEvent:FireClient(player)

end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

and this is the local script:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui", 500)
local hiEvent = ReplicatedStorage:WaitForChild("hiEvent")
local weewoo = Instance.new("ScreenGui", playerGui)
local tint = Instance.new("Frame", weewoo)
local blur = Instance.new("ImageLabel", weewoo)
    weewoo.Name = "weewoo"
    blur.Name = "Blur"
    tint.Name = "Tint"
	playerGui.weewoo.Enabled = false
	tint.BackgroundColor3 = Color3.fromRGB(64,111,52)
	tint.BackgroundTransparency = 0.6
	tint.Size = UDim2.new(1,0,1,0)
	blur.Size = UDim2.new(1,0,1,0)
	blur.ImageTransparency = 0.2
	blur.BackgroundTransparency = 1
	blur.Image = "rbxassetid://204446257"
local function onhiEventFired()
weewoo.Enabled = true
tint.Visible = true
blur.Visible = true
wait(90)
weewoo.Enabled = false
blur.Visible = false
tint.Visible = false

end
hiEvent.OnClientEvent:Connect(onhiEventFired())

1 answer

You're calling your function when you try to connect the event

hiEvent.OnClientEvent:Connect(onhiEventFired())

Should be

hiEvent.OnClientEvent:Connect(onhiEventFired)

You did it right the first time, so I can only assume that you don't understand how it works. I'd just look into events and functions a little bit more.

6 comments

0

But now when I try it after changing it to that it doesn't actually pop up the gui anymore when the button is pressed

0

The hardest thing about this is i want the gui to put up when an ingame model button is pressed not as soon as you join

0

I mean, the other thing is that you can't listen for clickdetectors on the server

0

So is there anyway to make it work?

0

Listen to the clickdetectors on the client? Duh

0

Listen to the clickdetectors on the client? Duh.

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