Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Torso Not Valid Member of Model?

Asked by 6 years ago

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

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) kilam2468 0 — 6y
0
Maybe it could be the cause of not putting the game in filter enabled mode. Axceed_Xlr 380 — 6y
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. Axceed_Xlr 380 — 6y
0
Could be the fact that in studio you are r6 and in game r15. Also, player.CharacterAdded:wait() is deprecated, use Wait() instead. AyeeAndrxw 35 — 6y
View all comments (5 more)
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 TheeDeathCaster 2368 — 6y
0
Game is Filtered enabled, and I have it force r6 kilam2468 0 — 6y
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")? kilam2468 0 — 6y
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). TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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)
0
I don't know if this will be helpful, but try changing line 3 into "local part = character:WaitForChild("Torso")". User#20279 0 — 6y
0
It did not help :( kilam2468 0 — 6y
Ad

Answer this question