Hi so basically I am creating a sword-fighting game with my friends to go in a game and I am trying to detect when 2 people stand on 2 parts they get teleported to a place and get auto-equipped with a sword. There is only 1 stand so only 2 people can play at once. This is my script so far, could someone help? Thank you xoxo
ALSO: When one of them dies, playing needs to go back to false and decider needs to go back to 0. That was one of the main issues.
local part1 = script.Parent.Part1
local part2 = script.Parent.Part2
local tp1 = script.Parent.Parent.Tp1
local tp2 = script.Parent.Parent.Tp2
local decider = 0
local playing = false
part1.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name] --Access character from workspace.
local player = game.Players:GetPlayerFromCharacter(plr) --Access (plr)
decider = decider+1
end
end)
part2.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name] --Access character from workspace.
local player = game.Players:GetPlayerFromCharacter(plr) --Access (plr)
decider = decider+2
end
end)
if decider == 2 then
end
buni xoxo

2 comments
just make 2 bool values and 1 brick the will set one to true and the other one will set the 2nd one to true then make a if statment, if the 2 bools are set to true then teleport them
sorry can you expand on this?