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

Remote Event Open/Close FE Error?

So I'm trying to make a open/close gui with FE on but it errors out. Can anyone help me fix it?

Script(In ServerScriptStoarge) :

local Storage = game:GetService('ReplicatedStorage')
local OpenEvent = Storage:WaitForChild('OpenShop')
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local Shop = Player:WaitForChild('ShopGui')
local Frame = Shop:WaitForChild('ShopFrame')
local Button = Shop:WaitForChild('OpenShop')
--Core

local function onFired()
	local open=false
	if open==false then
		open=true
		print('True')
	elseif open==false then
		open=false
		print('False')
	end
end

OpenEvent.OnServerEvent:Connect(onFired)

Local Script(Inside of a button) :


local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local Storage=game:GetService('ReplicatedStorage')
local Open=Storage:WaitForChild('OpenShop')

local function OnClick()
	Open:FireServer()
end

script.Parent.MouseButton1Click:Connect(OnClick)

1 comment

0

You dont need the local in line 10 of the server script and you dont need local in line 6 in the local script

1 answer

You made a false = false.

local function onFired()
    local open=false
    if open==false then
        open=true
        print('True')
    elseif open==true then -- whoopsie dasie.
        open=false
        print('False')
    end
end

You may also want to move the true/false to the local script but I won't do that.

Also, you're trying to ping LocalPlayer from a ServerScript; there isn't a player assigned with the script so it will error.

SERVER:

local Storage = game:GetService('ReplicatedStorage')
local OpenEvent = Storage:WaitForChild('OpenShop')
local Shop = Player:WaitForChild('ShopGui')
local Frame = Shop:WaitForChild('ShopFrame')
local Button = Shop:WaitForChild('OpenShop')
--Core

function onFired(player, status)
    if status==false then
        print('True') -- do your gui code here, and use "player" for the game.Players.LocalPlayer.
	return true
    elseif status==true then
        print('False')
	return false
    end
end
-- you can find out the value of the status by doing the following:
-- local x = onFired("test", true)
-- print(x) -- just look for the "x" boolean [must be a variable or in line.]
OpenEvent.OnServerEvent:Connect(onFired)

LOCAL

local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local Storage=game:GetService('ReplicatedStorage')
local Open=Storage:WaitForChild('OpenShop')

function onClick()
	Open:FireServer(status)
end

script.Parent.MouseButton1Click:Connect(OnClick)

This isn't tested, any errors that come up should be commented and I'll fix them.

Also, open your output window by pressing [top] View > Output

1 comment

0

AdministratorReece, It doesn't work it says "attempted to call a nil value"

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