Im pretty new to Scripting. And i have an idea for a game like tag, when someone gets hit or goes close to another person theyre the ones whos on and it likes a loop. However, ive looked around and i have tried most things to try and script this game but i cant. Would you use teams for making this sort of gamemode or something else. If theyre is a script out there that is able to change a persons team when touched by another person that would be very useful :)
yes there is, you can listen for when the any of the player's limbs are touched, then verify if the other touching part is a player's limb, if so then get their teams and swap em.. like this
local Players = game.Players Players.PlayerAdded:Connect(function(player) local character = player.Character or player.CharacterAdded:Wait(); local humanoid = character:WaitForChild("Humanoid"); humanoid.Touched:Connect(onLimbTouched) end) function onLimbTouched(other_limb, player_limb) local this_player = Players:GetPlayerFromCharacter(player_limb.Parent) local other_player = Players:GetPlayerFromCharacter(other_limb.Parent); if(other_player) then local other_color = other_player.TeamColor other_player.TeamColor = this_player.TeamColor this_player.TeamColor = other_color end end
Closed as Not Constructive by hiimgoodpack
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?