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())
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.