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

Why won't this open my Gui when i Fire the event?

So i'm pretty new to F.E. stuff, and Remotes...so i have these two script but they will not work for some reason can someone tell me why?

Script 1.

--Local Script Inside StarterPlayer scripts
game.Workspace.Shop.Button.ClickDetector.MouseClick:connect(function(player)
	local Event = game.ReplicatedStorage:WaitForChild("Shop_Event")
	Event:FireServer()
end)

Script 2.

--Server Script Inside the Shop Button
--The ServerEvent is inside ReplicatedStorage.
local Event = game.ReplicatedStorage:WaitForChild("Shop_Event")
Event .OnServerEvent:connect(function()
local player = game.Players.LocalPlayer
player.PlayerGui.ShopUi.Frame.Visible = true
player.PlayerGui.ShopUi.camera.Disabled = false
end)

1 answer

I noticed a few mistakes you've made. First, on line 4, you have a space between 'Event' and '.OnServerEvent'.

Also, you're trying to get the player in the server script, you can only do this in a local script, unless you pass the player argument.

What I would do is add a player parameter to the second script to the function on line 4, and remove line 5.

I hope this works.

1 comment

0

It does work in Play Solo but it will not work in Roblox Player/Client. @Master_JJ

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