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

How to CFrame local player?

My code:

wait(2)
game.Players.PlayerAdded:connect(function(newPlayer) -- Player who just connected (newPlayer)
   if newPlayer:IsInGroup(3846293) then -- Check if (newPlayer) is in the group, (The Blue Coat Mercenaries) then do this
     
   end
end)

My problem: So to teleport a player you do ``game.Workspace..LowerTorso/UpperTorso.CFrame = CFrame.new(Coordinates)

But I can't seem to be able to do that without actually using the so i'm trying to find the LocalPlayer and CFrame them if they are actually in the group.

1 answer

Hey epicfaceman12345678.

What you are trying to do is quite simple. All you need to do is identify the character and the torso from the player. You already have the player(newPlayer) just get the Character. I will show you how to do that below.

####Script

local plrs = game:GetService("Players");

plrs.PlayerAdded:Connect(function(plr)
	
	if plr:IsInGroup(3846293) then

		local character = plr.Character or plr.CharacterAdded:Wait();
		
		local torso = character:WaitForChild("HumanoidRootPart") -- Better to use the HumanoidRootPart than the torso in my opinion.

		torso.CFrame = CFrame.new() -- The CFrame is set here. Make sure to add the values for the CFrame.

	end

end)

###Well, I hope I helped and have a nice day!

~~ KingLoneCat

5 comments

0

This isn't working I get this "16:00:09.052 - CoreGui.RobloxGui.DeveloperConsole.Interior.WindowContainer.Window.Body.ActionBindings.ScrollingFrame.UIListLayout: SortOrder.Custom is deprecated, please switch to LayoutOrder" - Not sure if it's normal but either way the script does not work.

0

That error isn't pretaining to this script at all. That comes up in my output from time to time too, it isn't because of your script.

0

Did you make sure to put the code in a Server Script in ServerScriptService?

0

Yeah I did

0

I add Vector3() inside of CFrame but either way it doesn't work, I can do just a normal CFrame and it still wouldn't work.

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