Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
NexeusX 137
7 years ago

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

Log in to vote
1
Answered by
Master_JJ 229 Moderation Voter
7 years ago

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.

0
It does work in Play Solo but it will not work in Roblox Player/Client. @Master_JJ NexeusX 137 — 7y
Ad

Answer this question