I am doing the alvin blox sword game and then i try testing the game it would just say intermission then desert map chosen and it wont teleport, here is my code please help me:
-- Define variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MapsFolder = ServerStorage:WaitForChild("Maps")
local Status = ReplicatedStorage:WaitForChild("Status")
local GameLength = 120
local reward = 15
-- Game Loop
while true do
Status.Value = "Waiting For Enough Players"
repeat wait(1) until game.Players.NumPlayers >= 2
Status.Value = "Intermission"
wait(10)
local plrs = {}
for i, player in pairs(game.Players:GetPlayers()) do
if player then
table.insert(plrs,player) -- Add Each Player Into plrs Table
end
end
wait(2)
local AvailableMaps = MapsFolder:GetChildren()
local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]
Status.Value = ChosenMap.Name.." Chosen"
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace
-- Teleport Players To The Map
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
if not SpawnPoints then
print("SpawnPoints Not Found!")
end
local AvailableSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character = player.Character
if character then
-- Teleport Them
character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFarme + Vector3.new(0,10,0)
table.remove(AvailableSpawnPoints,1)
-- Give Them a Sword
local equipped = game.ServerStorage.PlayerData[player.Name].Equipped
if equipped.Value ~= "" then
local weapon = game.ServerStorage.Items[equipped.Value]:Clone()
weapon.Parent = player.Backpack
else
local Sword = ServerStorage.Sword:Clone()
Sword.Parent = player.Backpack
end
local GameTag = Instance.new("BoolValue")
GameTag.Name = "GameTag"
GameTag.Parent = player.Character
else
-- There is no character
if not player then
table.remove(plrs,i)
end
end
end
end
Status.Value = "Get Ready To Play"
wait(2)
for i = GameLength,0,-1 do
for x, player in pairs(plrs) do
if player then
character = player.character
if not character then
-- Left the game
table.remove(plrs,x)
else
if character:FindFirstChild("GameTag") then
-- they are still alive
print(player.Name.." Is still in the game!")
else
--They are dead
table.remove(plrs,x)
print(player.Name.." Has been removed!")
end
end
else
table.remove(plrs,x)
print(player.Name.." Has been removed!")
end
end
Status.Value = "There are "..i.." seconds remaining, and "..#plrs.." players left"
if #plrs == 1 then
-- last person standing
Status.Value = "The winner is "..plrs[1].Name
plrs[1].leaderstats.Money.Value = plrs[1].leaderstats.Money.Value + reward
break
elseif #plrs == 0 then
Status.Value = "No Winner!"
break
elseif i == 0 then
Status.Value = "Time's Up!"
break
end
wait(1)
end
print("End of Game")
wait(2)
for i, player in pairs(game.Players:GetPlayers()) do
character = player.character
if not character then
--ignore them
else
if character:FindFirstChild("GameTag") then
character.GameTag:Destroy()
end
for _, tool in pairs(player.Backpack:GetChildren()) do
if tool:FindFirstChild("Price") then
tool:Destroy()
end
end
for _, tool in pairs(character.GetChildren()) do
if tool:FindFirstChild("Price") then
tool:Destroy()
end
end
end
player:LoadCharacter()
end
ClonedMap:Destroy()
Status.Value = "Game Over"
wait(2)
end
COMMUNITY QUESTION
CFrame is not a valid member of part Please help?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
Please use codeblocks in your script
Also provide us with the exact error and which line it is on.
The problem is at the line where it says: character:FindFirstChild(“HumanoidRootPart”).CFrame= AvailableSpawnPoints[1].CFrame + Vector3.new(0,10,0)
Codeblocks please!
What Does That Mean?
Please use codeblocks, it's a lot easier to read for us.
I added codeblock, i think
Can anyone answer me please
Seriously this site is called scripting helpers