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

Break joints is not a valid member of player?

i am making my own admin commands and in that i was adding a kill command so when the command is executed this is the line i wrote to kill the player

plr:BreakJoints()

but this tells me that break joints is not a balid member of player where am i going wrong? ThankYou

2 answers

✓ Accepted answer

Get the Local Player through game.Players.LocalPlayer (localscript context) or through the game.Players.PlayerAdded (server script context) event.

Player objects have a property called "Character." You can retrieve this through Player.Character or (if they aren't loaded), Player.CharacterAdded:Wait().

The Character is a model, and all instances that are models or inherits from models have the BreakJoints method:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character) 
		Character:BreakJoints();
	end)
end)

Note that you should have your line like this in the case of using CharacterAdded:Wait():

local Character = Player.Character or Player.CharacterAdded:Wait(), as if you only have the CharacterAdded:Wait while the character is already loaded, your code will have to wait until the character respawns before your code can run. We use or to handle that.

The "player" Isn't the CHARACTER Unless stated otherwise.

The player is a different entity than the "character" if you don't have it defined as the "plr" being the Character (which is located in the workspace).

think if it this way; ":BreakJoints()" Is used to break apart the players model's joints. You can't break something without joins, right?

Try this instead;

-- Define your Character
(local char = plr.Character) -- If in local script

--[[ If in a Server Script, and the local player is already defined, then this SHOULD still work as requested. ]]--

char:BreakJoints()

This should work! ~BryanFehr Disc; BryanFehr#3070

2 comments

0

Player is never the character. "plr" is not implicitly defined. You don't paranthesize variable statements. ServerScripts don't have a LocalPlayer.

0

Ah, didn't see my error. I was writing this out in just text, then realized codeblocks. Lol. Although, you will need the "player" to find the Character.

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