Position cannot be assigned to

I am currently scripting a map-round shooter game and a script I made is acting up

local value = game.ReplicatedStorage.RoundOn

value:GetPropertyChangedSignal("Value"):Connect(function()
	wait(1)
	local spawnpoints = game.Workspace:WaitForChild("Map").Spawnpoints:GetChildren()
	if value.Value == true then
		for _, player in ipairs(game.Players:GetChildren()) do
			local spawnpntnum = math.random(1,5) --getting what number spawnpoint to spawn at
			local spawnpnt = spawnpoints[spawnpntnum] --transferring number value to spawnpart
			print(spawnpntnum)
			print(spawnpnt)
			local humanroot = player.Character.HumanoidRootPart --getting humanoidrootpart
			humanroot.CFrame.Position = spawnpnt.CFrame.Position -- not teleporting when suppost to
		end
	end
	
end)

this script is supposed to teleport the player to the chosen spawn part but instead it returns “Position cannot be assigned to - Server - PlayerTeleportWhenRoundStart/Die:13”

You can set the position directly:

local value = game.ReplicatedStorage.RoundOn

value:GetPropertyChangedSignal("Value"):Connect(function()
	wait(1)
	local spawnpoints = game.Workspace:WaitForChild("Map").Spawnpoints:GetChildren()
	if value.Value == true then
		for _, player in ipairs(game.Players:GetChildren()) do
			local spawnpntnum = math.random(1,5) --getting what number spawnpoint to spawn at
			local spawnpnt = spawnpoints[spawnpntnum] --transferring number value to spawnpart
			print(spawnpntnum)
			print(spawnpnt)
			local humanroot = player.Character.HumanoidRootPart --getting humanoidrootpart
			humanroot.Position = spawnpnt.Position -- not teleporting when suppost to
		end
	end
	
end)
1 Like

thx bro honestly dont know why I didnt try that

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.