Hi, I’m making a RolePlay game (Hospital),
I’m a newbie to scripting and I need to know how to make sure that when someone tries to join a team, a message appears saying “team complete!”.
1.- I want that when “1” player is in a team, when someone tries to enter that team, a GUI will appear that says “Full team”
2.- To enter a team, I have BUTTONS with scripts that change your team. I want when player “1” is on that team,
when another player tries, say “Team complete”
This DevForum Section is for scripting support, We help and support on scripts not create scripts.
2.The task you want to complete would be more complex than a few lines as it requires remote function, guis, and Teams. you will need to create this entire system on your own but any trouble you may have we can help with.
Putting “No Pay” in the title suggests its a task or job that you want people to do for you. If you want someone to do this task for you. Place it in recruitment. You would need to offer pay since people are not willing to do tasks for free.
What you would want to do is have a click detector in the block. That click detector would fire a remote event to the player. That would bring up the UI
I can probably write up a script later today for you.
–If you want to hire a scripter, you might want to put it in the ‘Collaboration’ place
So basically, you have to use #team:GetPlayers() to know how many players are in the team
You may loop through this table if you want to, if you want some additional things
It’s a same process when making a button, but you’ll need to use remote functions to return a boolean value, and get acsess to the server.
And you can make a reomte event notifying Team complete or Team full, you might want to make only one event about it, and make every notifications to “Team full”. This can be done by using a player’s gui and make it invisable, then you can turn it visable in the event
You might want to use tweenservices using the event, that’s up to you
And as @Wizard101fire90 said, this will be quite complecated for new people, and I don’t know how good you’re at scripting.
You don’t have to display [NO PAY] because lots of people in the scripting support are willing to help free, and that’s one of the reason scripting support is a thing
pls say what button you’re talking about
if it’s a gui button, you don’t need a clickdetector, mouse.button1down will be the event to use
but if it’s a part, you need something like a click detector.
–Define a remote event notify
local Fullnum = 1
-Define the part which have to be touched
Part.Touched:Connect(function()
local Character = Part.Parent
if Character:FindFirstChildWhichIsA(“Humanoid”) then
local Player = game.Players:WaitForChild(Character.Name
if #(Team):GetPlayers() < Fullnum then
Player.Team = (Team)
else
Notify:FireClient()
end
end
end
end)
You might want to define a debounce, so it won’t lag
What will happen is if the team is full, you will receive this popup. Otherwise you will be teamed
Lets begin
In the script, this is what I wrote
local team = game.Teams.Team2 -- Switch team2 to your team
local teamPart = script.Parent
local teamLimit = 1 -- Only 1 player on the team
local currentPlayers = #team:GetPlayers() -- How many people are on the team
local guiEvent = script.Parent.GuiEvent
local debounce = false --Will be used to prevent spamming the touch event
teamPart.Touched:Connect(function(partThatTouched) -- We are detecting when something touches the block
if debounce == false then
debounce = true
if game.Players:GetPlayerFromCharacter(partThatTouched.Parent) then -- Finds out if that is player
if currentPlayers < teamLimit then --Checking to see how many players are on the team
game.Players:GetPlayerFromCharacter(partThatTouched.Parent).Team = team -- Changing team
else
guiEvent:FireClient(game.Players:GetPlayerFromCharacter(partThatTouched.Parent))
end
end
wait(1)
debounce = false
end
end)
I encourage other people reading to avoid doing this and instead just point the OP in the right direction by explaining principles or concepts instead of giving them a script.