Basically I asked a previous question which I thought when it was answered would answer the problem to what I'm trying to do.
GroupID = 3713839 Button = script.Parent.Screen.SurfaceGui.Frame.Button Button.MouseButton1Click:Connect(function(Clicked) local Player = game.Players:GetPlayerFromCharacter(Clicked.Parent.Parent) local ServerStorage = game.ServerStorage if Player:IsInGroup(GroupID) then Button.Text = "Currently in use" Button.TextSize = 55 end end)
I don't know what to do. The group Id is correct I just can't get the player.
Everything is correct except for the fact that you're trying to get the player from the nothing. There is no argument from MouseButton1Click. If you do insert a click detector, however, you can do this:
local groupId = 3713839 local button = script.Parent.Screen.ClickDetector button.MouseClick:(function(player) local serverStorage = game:GetService("ServerStorage') if player:IsInGroup(groupId) then button.Text = "Currently in use." button.TextSize = 55 end end)
The first question you asked was about when you touch a part. If your doing it via a GUI then you do not need to use GetPlayerFromCharacter as you are using a local script for a GUI.
A local script already knows who the player is. Therefore you can reference the player as:
player = game.Players.LocalPlayer
Therefore you can adjust your script as such (put the local script in the button):
GroupID = 3713839 --Function that runs when the button is clicked. script.Parent.MouseButton1Click:Connect(function() --References the player (you can only reference the player like this in a local script.) local Player = game.Players.LocalPlayer --Checks if the player is in the group and changes the text if so. if Player:IsInGroup(GroupID) then script.Parent.Text = "Currently in use" script.Parent.TextSize = 55 end end)