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

How can i remove the touch to claim door with this script?

Asked by 6 years ago
local part = script.Parent -- variable for part
local claimed = false -- sets a boolean to check if the door is claimed or not

part.Touched:connect(function(hit) -- when the part is touched, hit is defined as the thing that touched the part
    if game.Players:FindFirstChild(hit.Parent.Name) and claimed == false then -- checks hit is a player
        claimed = true -- the door is now claimed
        local player = game.Players:FindFirstChild(hit.Parent.Name) -- defines the player variable
        player.Neutral = false -- now the player is in a team
        player.Team = game.Teams.blue -- change blue to whatever team you want it to be (the team has to be already created)
    end
end)

is this a good script or is there something missing? please let me know

0
You could set the door's transparency to 1 and it's CanCollide property to false, that way it's not really there anymore but still exists. Nidoxs 190 — 6y
0
and where should i put it then on what sentence? bramieboy241 -19 — 6y
0
Uhh if you would of removed the claiming part, then nothing would be happening when you touch the door, what exactly are you trying to do ? F4ULT1NTH3D4T4 226 — 6y
0
Can you please use a little common sense on when you put the line of code? Just a little bit. hiimgoodpack 2009 — 6y

Answer this question