You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? i wanted to make an ability to heal all players in the same team as me
What is the issue? i can’t think of how i can code it. here’s my unfinished code:
script.Parent.ChangeChar.OnServerEvent:Connect(function(OnPlayer)
local CastAbility = game.ReplicatedStorage.CastAbility
local name = script.Parent.Parent.Name
local player = game:GetService("Players").name
local team = player.Team
local red = game:GetService("Teams")["Red"]
local blue = game:GetService("Teams")["Blue"]
if team == red then
--heal for red members only
elseif team == blue then
--heal for blue members only
end
script.Parent.AbilityActive.Value = false
script.Parent.ReturnChar:FireClient(OnPlayer)
end)
What solutions have you tried so far? i have tried looking to the internet, but i can’t find any solution
local healAmount = 20 -- Amount to heal
local MaxDistance = 20 -- Heals player if they are within a certain distance
HealPlayersRemotEvent.OnServerEvent:Connect(function(ourPlayer) -- Assuming a remoteevents fires to heal players.
local ourCharacter = ourPlayer.Character -- our character
for _,player in game.Players:GetPlayers()
if player.Team == ourPlayer.Team then -- we see if player is on our team
local character = player.Character -- the friendly players charcter
local humanoid = character.Humanoid
if (character.PrimaryPart.Position-ourCharacter.PrimaryPart.Position).Magnitude < MaxDistance then -- we do distance checks
humanoid.Health += healAmount -- health added
end
end
end
end)