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

Torso Not Valid Member of Model?

REALLY Confused on this, Been going around on posts but nothing as fixed this for me. It works FLAWLESSLY on Studio but NON of my Local Scripts in StarterGui dont activate. Any help is appreciated. My Freeze Script for a "start" button

local player = game.Players.LocalPlayer
local Target = player.Character.Torso
local Cam = workspace.Camera
local char = player.Character
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end
local torso = char:FindFirstChild("Torso")
local hum = char:FindFirstChild("Humanoid")
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CameraSubject = player.Character.Torso
while true do
Cam.CoordinateFrame = CFrame.new(Target.Position) * CFrame.Angles(0,3.2,0) * CFrame.new(-2,0,5)

	wait(0.1)
end

9 comments

0

Btw, Its as if NONE of my StarterGui Local Scripts activate in the roblox game which is the complete opposite of my studio experience. To put it shortly (Works in Studio, does not in Actual game)

0

Maybe it could be the cause of not putting the game in filter enabled mode.

0

The experimental mode tends to complete stop a lot of scripts from working in game. I had similar issues. After turning it on, it worked flawlessly. Hope it helps.

0

Could be the fact that in studio you are r6 and in game r15. Also, player.CharacterAdded:wait() is deprecated, use Wait() instead.

0

Might also be that the torso hadn't loaded yet. Try using WaitForChild. :> http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild

0

Game is Filtered enabled, and I have it force r6

0

@TheeDeathCaster Would the command for wait child in my script be like local part = game.Players.LocalPlayer:WaitForChild("Torso") print(part.Name "added to workspace")?

0

WaitForChild waits (or "listens") for when the object is added/created into the specified parent object (thus Parent:WaitForChild(ChildName)), so it should wait until the part comes into play (in this case, the Torso). (Check Wiki document for more information).

1 answer

Still need help :( would appreciate it if you looked at comments. Also I tried to update the script with waitforchild, and it did not help, I updated the script with Character Added and it did not work either. Game is Filtered enabled.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
	local part = game.Players.LocalPlayer.Character:WaitForChild("Torso")
	print(part.Name .. " added to workspace")
	local player = game.Players.LocalPlayer
	local nameofplayer = player.Character.Name
	if player and player.Character then
		local Target = game.Players.LocalPlayer.Character.Torso
		local Cam = workspace.Camera
		local char = player.Character
		if not character or not character.Parent then
    	character = player.CharacterAdded:wait()
		end
	local torso = char:FindFirstChild("Torso")
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CameraSubject = player.Character.Torso
	while true do
	Cam.CoordinateFrame = CFrame.new(Target.Position) * CFrame.Angles(0,3.2,0) * CFrame.new(-2,0,5)

		wait(0.1)
	end
	end
end)
end)

2 comments

0

I don't know if this will be helpful, but try changing line 3 into "local part = character:WaitForChild("Torso")".

0

It did not help :(

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