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

Script in ServerScriptStorage fires errors when playing in-game, but works in Studio?

I have a script, remotefunction, etc. that open a shop when you right click on a part, that works perfectly in studio, but I always get the same errors in-game! Could someone please assist me?

The error I get in-game: https://gyazo.com/c152f5a990f8826a43c92aa69846ce8b

What it should look like when I buy it: https://gyazo.com/0a29e9f208e8e2d37e877904ebfef2db

The code basically opens the menu when the remoteevent is fired and IS STORED IN SERVERSCRIPTSTORAGE

This is the code that is getting the error:

local open= game.ReplicatedStorage.menuEvent
open.OnServerEvent:connect(function(plr, id)
	repeat wait() until plr.PlayerGui.Main~= nil
	plr.PlayerGui.Main.Frame.Value.Value=id 
	plr.PlayerGui.Main.Frame.Visible=true
end)

Client sided (fires the event):

children=workspace.Planets:GetChildren()
for i=1, #children do
children[i].detect.ClickDetector.RightMouseClick:connect(function()
	print"db"
	game.ReplicatedStorage.menuEvent:FireServer(children[i].Name)
	print"debug"
end)
end

Please help!

2 comments

0

The server can't access the descendants of the players' playerguis when fe is enabled. It's best to do it in a localscript. You should paste the client - sided part of the script too

0

Alrighty

1 answer

Thanks for the comment, chexy. After reading that I realized how redundant the whole thing was, so I moved it all to clientside and it now works, thank you!

-Green

1 comment

0

np

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