Gui not appearing

no errors for StateGunHud when firing server

local Mouse = Player:GetMouse()

local Gun = script.Parent.Parent.Gun

local UserInputService = game:GetService('UserInputService')
local TweenService = game:GetService('TweenService')
local Camera = workspace.CurrentCamera
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Bullets = ReplicatedStorage:WaitForChild('Bullets')
local BulletType = Bullets:WaitForChild('BulletType')

local Events = ReplicatedStorage:WaitForChild('Events')
local RemoteEvents = Events:WaitForChild('RemoteEvents')

local StateGunHud = RemoteEvents:FindFirstChild('StateGunHud')

Gun.GripUp = Vector3.new(0,1,0)
Gun.GripRight = Vector3.new(0,0,1)


local Index = {['ZoomIn'] = 65, ['ZoomOut'] = 75}
local Info = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)


local function TweenCamera(Properties)
	local T = TweenService:Create(game.Workspace.CurrentCamera, Info, Properties)
	T:Play()
end


local equipped = false
local function Zoom(key)
	if Player and Player.Character then
		UserInputService.InputBegan:Connect(function(input)
			if input.UserInputType == Enum.UserInputType[key] then
				if equipped then
				local Properties = {FieldOfView = Index.ZoomIn}
                TweenCamera(Properties)
                wait(0.1)
                   StateGunHud:FireServer(true)
				end
				end
					end)
						UserInputService.InputEnded:Connect(function(input)
							if input.UserInputType == Enum.UserInputType[key] then
								if equipped then
					      local Properties = {FieldOfView = Index.ZoomOut}
					      TweenCamera(Properties)
					wait(0.1)
					StateGunHud:FireServer(false)
					end
					end
							end)
						end
			end
			
					
            
		 Gun.Equipped:Connect(function()
			equipped = true
			Zoom('MouseButton2')
			Mouse.Icon = 'rbxassetid://61374156'
		end)
		
		
		
	    
		Gun.Unequipped:Connect(function()
			local Properties = {FieldOfView = Index.ZoomOut}
			TweenCamera(Properties)
			equipped = false
			Mouse.Icon = ''
			wait(0.1)
			StateGunHud:FireServer(false)
		end)

To make the gui appear

local Events = ReplicatedStorage:WaitForChild('Events')
local RemoteEvents = Events:WaitForChild('RemoteEvents')
local StateGunHud = RemoteEvents:FindFirstChild('StateGunHud')

local Main = script.Parent.Parent.Parent:WaitForChild('Main')
local GunHudGui = Main:WaitForChild('GunHudGui')

StateGunHud.OnClientEvent:Connect(function(Player, Visibility)
	GunHudGui.Visible = Visibility
end)```

Have you checked whether the GUI is enabled? Are both Local Scripts?

yes i already did, ,

check ui

Can you please send a snippet of your explorer where the scripts are located?

download did u mean this?

StateGunHud:FireServer(false)

Here you fire the server

StateGunHud.OnClientEvent:Connect(function(Player, Visibility)

But here’s OnClientEvent. I don’t think you can fire the Client from a LocalScript.

You event doesn’t even fire. That’s the reason why there is no error.

I know that you are using :FireServer, but OnClientEvent doesn’t register :FireServer()

681766487492657153 thats why its not working, thank you

1 Like