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

CFrame Character into a spawnlocation not working for my Intermission Script?

I have attempted to CFrame the player to a specific position into a generated map cloned to workspace once the Countdown reaches 1 without spawning inside the floor, however it is not working for me, can anyone help with this please? I also attempted to create a forcefield around the player, it also did not work. I don't what's wrong with my script.

Server Script in ServerScriptService

local countdown = game.ReplicatedStorage.Values:WaitForChild("countdown")

for i = 15,0,-1 do
	countdown.Value = i
	if i == 1 then
		local map = math.random(1,3)
		if map == 1 then
			game.ReplicatedStorage.Maps.Normal:Clone().Parent = workspace.Map
		end
		if map == 2 then
			game.ReplicatedStorage.Maps.Red:Clone().Parent = workspace.Map
		end
		if map == 3 then
			game.ReplicatedStorage.Maps.Green:Clone().Parent = workspace.Map
		end
		print(map)
		for i, v in pairs(game.Players:GetPlayers()) do
			local spawnLocation = workspace.Map.FindFirstChildOfClass("Model").SpawnLocation
                       
			v.Character.Torso.CFrame = spawnLocation.CFrame(spawnLocation.Position.X, spawnLocation.Position.Y + 10, spawnLocation.Position.Z)
			local FF = Instance.new("ForceField")
			FF.Clone()
			FF.Parent = v.Character.Torso
			wait(5)
			FF:Destroy()
		end
	end
	wait(1)
end

4 comments

0

am I missing something?

0

There's a property of the player Player.RespawnLocation. https://developer.roblox.com/en-us/api-reference/property/Player/RespawnLocation and with the LoadCharacter function should achieve this https://developer.roblox.com/en-us/api-reference/function/Player/LoadCharacter

0

I tried Player:LoadCharacter() before but thanks for help, I will try looking through this.

0

almost got it

1 answer

It looks like you are trying to change the CFrame of the torso, which will not work since the player's primary part is the HumanoidRootPart. Therefore you would have to replace

v.Character.Torso.CFrame

with

v.Character.HumanoidRootPart.CFrame

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