Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make it so only one team can click a block and it teleports?

Asked by 6 years ago

Hey! I have no clue how to do this! so let me explain I want to make it so only 1 team can click the block and when that team does it teleports to certain place.

0
Please refer to the wiki for basic scripting lessons. You would be looking for things like Click detectors, CFraming, and teamColors. Bellyrium 310 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You would need to do something similar to:

local part = script.Parent -- Defining the part the player clicks on
local clickDetector = Instance.new("ClickDetector", part) -- Creating a ClickDetector inside the part
local teleportToPosition = CFrame.new(10,1,1) -- Where the character teleport to

clickDetector.MouseClick:connect(function(player) -- When player clicks the part
    if player.TeamColor == BrickColor.new("Really red") then -- Change "Really red" to the BrickColor value of the team you want to be able to teleport 
        player.Character.HumanoidRootPart.CFrame = teleportToPosition -- Teleports player
    end
end)

This script will check what team a player is on when they press the button and teleport that player if they are on the right team.

Hope this helps.

Ad

Answer this question