Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mapVotes = {}
- local maps = {"Map1", "Map2", "Map3"}
- game.Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(character)
- local humanoid = character:WaitForChild("Humanoid")
- local rootPart = character:WaitForChild("HumanoidRootPart")
- for i, mapName in ipairs(maps) do
- local mapBrick = workspace:FindFirstChild(mapName)
- if mapBrick then
- mapBrick.Touched:Connect(function(otherPart)
- if otherPart.Parent == humanoid.Parent then
- mapVotes[mapName] = (mapVotes[mapName] or 0) + 1
- print(player.Name .. " voted for " .. mapName)
- end
- end)
- end
- end
- end)
- end)
- --------------------------Use this script if you want the player to be teleported to the map that won--------------------------
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local mapVotes = {}
- local maps = {"Map1", "Map2", "Map3"}
- local winningMap = "Map1"
- for _, player in ipairs(Players:GetPlayers()) do
- local character = player.Character
- if character then
- local spawnLocation = ReplicatedStorage.Maps:FindFirstChild(winningMap)
- if spawnLocation then
- character:SetPrimaryPartCFrame(spawnLocation.CFrame + Vector3.new(0, 5, 0))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement