Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I have a problem the script wont teleport players i just get an error what do i do?

the error is Cframe is not a valid member of Part "Workspace.Forest.SpawnPoints.SpawnPoints"

the line of code that isnt working is

character:FindFirstChild("HumanoidRootPart").Cframe = AvailableSpawnPoints[1].Cframe

the chunk of code is

local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")

if not SpawnPoints then
		print("no spawnpoints")
	end
	
local AvailableSpawnPoints = SpawnPoints:GetChildren()
	
	for i, player in pairs(plrs) do
		if player then
			character = player.Character
			
			if character then
			--teleports them
				
			character:FindFirstChild("HumanoidRootPart").Cframe = AvailableSpawnPoints[1].Cframe
			else
			table.remove(AvailableSpawnPoints,1)
				
				
				local Sword = ServerStorage.Sword:Clone()
				Sword.Parent = player.Backpack
				
				local GameTag =Instance.new("BoolValue")
				GameTag.Name = "GameTag"
				GameTag.Parent = player.Character
				
			end
				
				if not player then
					table.remove(plrs,i)
					
				end
			end
		end
	end

1 comment

0

It's CFrame

1 answer

In LUA everything needs to be case sensitive. Its CFrame, not Cframe.

This discussion is preserved as it was. New answers, comments, and votes are closed.