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

Why will this OnServerEvent not working?

workspace.LevelUp.OnServerEvent:connect(function(player)
	game.Players.player.StarterGui.MainGui.LevelUpFrame.Visible = true
end)

1 answer

✓ Accepted answer

1.You can only use OnServerEvent in serverscripts 2.You have to connect the event not 'workspace.LevelUp' 3.You can't call "Players.player" thats gonna be an error

Since in the function(player) you already called a player, you could just use player.StarterGui instead of game.Players.player.

This should be the correct code :

|ServerScript|

local Event = writewhereyoureventislocated

Event.OnServerEvent:connect(function(player)
player.StarterGui.MainGui.LevelUpFrame.Visible = true
end)

Hope this helps!

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