My local script is in StarterPlayerScript and its enabled but when a player steps on Part both player1 and player2's partSelect Variables go up. I only want the player's Variable who steps on the part to go up. I don't believe there is anything wrong with my code but who knows. Any help would be greatly appreciated.
local object = workspace.Part
local debounce = false
local partSelect = 0
local function test(hit)
if hit.Parent:FindFirstChild("Humanoid")then
if debounce == false then
debounce = true
local player = hit.Parent
if partSelect <= 3 then
partSelect = partSelect + 1
end
if partSelect == 4 then
partSelect = 1
end
local part = game.Workspace:FindFirstChild("Part" .. partSelect)
player.HumanoidRootPart.CFrame = CFrame.new(part.Position)
wait(1)
debounce = false
end
end
end
object.Touched:Connect(test)

1 comment
Thank ya man! I still just don’t understand why the original code didn’t work since it works only on a player to player basis..