****This is a local script in a GUI on a filtering enabled game, I'm designing it for creating groups in which players can make so they don't accidentally kill each other, this script looks perfect to me and has no output errors, however, the ObjectValue is never created when I look.
function group() if script.Parent.crgroup.Text == "Create Group" then script.Parent.crgroup.text = "Disband Group" grouper = Instance.new("ObjectValue") grouper.Parent = game.Players.LocalPlayer grouper.Name = "GroupLeader" script.Parent.Invite.Visible = true script.Parent.NameInvite.Visible = true else local findgroup = game.Players.LocalPlayer:FindFirstChild("GroupLeader") if findgroup then findgroup:Destroy() end end end function inviteplayer() for i,v in ipairs(game.Players:GetChildren()) do if v.Name == script.Parent.NameInvite.Text then --to be continued end end end script.Parent.crgroup.MouseButton1Click:connect(group) script.Parent.Invite.MouseButton1Click:connect(inviteplayer)
By the way, I am not good at scripting but have a semi general understanding.
As kingdom5 says, you need to put some of this logic on the server.
LocalScripts (client code) should only deal with stuff that pertains to one person (especially a player's input and showing GUIs to that player). The server should be responsible for things that affect multiple players (and anything that you don't want a player to be able to mess with - ex, cash).
In case you're not familiar, here's a tutorial for Remote Events/Functions, which you'll need to have the GUI code tell the server code that the player wants to create a group and/or invite others to it.