7Mehdi
|
  |
| Joined: 12 Jan 2015 |
| Total Posts: 503 |
|
|
| 12 May 2015 03:47 PM |
Hi, I have this script that is suppose to teleport you to Part2 if you touch Part1 and you have to be on team color Bright blue for this to work but it doesn't work, can someone please help me fix this?
local teamColor = BrickColor.new("Bright blue") local startPart = script.Parent local endPart = workspace.Part2
local function getCharacterFromHit(hit) while hit.ClassName ~= "workspace" or hit.ClassName ~= "Model" do hit = hit.Parent end if hit.ClassName == "Model" then return hit end end
local function onTouch(hit) local character = getCharacterFromHit(hit) local player = character and game.Players:GetPlayerFromCharacter(character)
if player and player.TeamColor == teamColor and player.Neutral == false then character:MoveTo(endPart.Position) end end
startPart.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
7Mehdi
|
  |
| Joined: 12 Jan 2015 |
| Total Posts: 503 |
|
| |
|
|
| 12 May 2015 03:52 PM |
local teamColor = BrickColor.new("Bright blue") local startPart = script.Parent local endPart = workspace.Part2
startPart.Touched:connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and plr.TeamColor == teamColor and not player.Neutral and plr.Character then plr.Character:MoveTo(endPart.Position) end end) |
|
|
| Report Abuse |
|
|
7Mehdi
|
  |
| Joined: 12 Jan 2015 |
| Total Posts: 503 |
|
|
| 12 May 2015 03:56 PM |
thanks but it still doesn't work for some reason 😭 i think its because of the "and not player.Neutral and plr.Character" any tips? |
|
|
| Report Abuse |
|
|
7Mehdi
|
  |
| Joined: 12 Jan 2015 |
| Total Posts: 503 |
|
| |
|
|
| 12 May 2015 03:58 PM |
| No problem, I'm glad I could help, but I could barely read your code so I kinda rewrote it lol. |
|
|
| Report Abuse |
|
|