generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: This makes no sense.

Previous Thread :: Next Thread 
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
24 Apr 2013 01:40 AM
if game.Players.LocalPlayer.Character.Shirt ~= nil then
game.Players.LocalPlayer.Character.Shirt:Destroy()
end

02:37:42.648 - Shirt is not a valid member of Model
02:37:42.649 - Script "Workspace.Player1.Rotate", Line 16
02:37:42.650 - stack end

There's more to the script, but that's that part that fails. The rest of the script doesn't continue. The first line is number 16.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
24 Apr 2013 01:59 AM
Entire script if matters:

wait(1)
local target = game.Workspace.CameraScript.PosChecker
local camera = game.Workspace.CurrentCamera
local angle = 100
local char = game.Players.LocalPlayer.Character
local LP = game.Workspace:findFirstChild("LoadingPlatform")
slow,norm,fast = .6,1.2,1.8
custom = 2.4

camera.CameraType = "Scriptable"
camera.CameraSubject = target
LP = game.Workspace.LoadingPlatform
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
game.Players.LocalPlayer.Character.Torso.CFrame = LP.CFrame

if game.Players.LocalPlayer.Character.Shirt ~= nil then
game.Players.LocalPlayer.Character.Shirt:Destroy()
end

if game.Players.LocalPlayer.Character.Pants ~= nil then
game.Players.LocalPlayer.Character.Pants:Destroy()
end

game.Players.LocalPlayer.Character["Body Colors"].LeftArm = BrickColor.new("Bright Yellow")
game.Players.LocalPlayer.Character["Body Colors"].HeadColor = BrickColor.new("Bright Yellow")
game.Players.LocalPlayer.Character["Body Colors"].LeftArm = BrickColor.new("Bright Yellow")
game.Players.LocalPlayer.Character["Body Colors"].RightArm = BrickColor.new("Bright Yellow")
game.Players.LocalPlayer.Character["Body Colors"].LeftLeg = BrickColor.new("Bright Yellow")
game.Players.LocalPlayer.Character["Body Colors"].RightLeg = BrickColor.new("Bright Yellow")

while wait() do
camera.CoordinateFrame = CFrame.new(target.Position) --Start at the position of the part
* CFrame.Angles(0, math.rad(angle), 0) --Rotate by the angle
* CFrame.new(0, 5, 0) --Move the camera up 5 studs
angle = angle + norm
end
Report Abuse
juzzbyXfalcon is not online. juzzbyXfalcon
Joined: 02 Feb 2011
Total Posts: 1311
24 Apr 2013 02:03 AM
if game.Players.LocalPlayer.Character:findFirstChild("Shirt") then
game.Players.LocalPlayer.Character.Shirt:Destroy()
end

Same for pants..

-Knowledge is power-
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
24 Apr 2013 02:04 AM
The shirt isn't loaded. Ever noticed when you forst join a game you're not wearing anything right away.

Change..

if game.Players.LocalPlayer.Character.Shirt ~= nil then

too

if game.Players.LocalPlayer.Character:FindFirstChild ("Shirt") ~= nil then
Report Abuse
juzzbyXfalcon is not online. juzzbyXfalcon
Joined: 02 Feb 2011
Total Posts: 1311
24 Apr 2013 02:07 AM
~= nil part isn't even needed. And if statement combined with a findFirstChild will do nothing when it can't find the child :)

-Knowledge is power-
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
24 Apr 2013 04:07 AM
I know. But it's how I learned it a while back. So I just stick with it.
Report Abuse
Voxility is not online. Voxility
Joined: 15 Apr 2013
Total Posts: 584
24 Apr 2013 06:34 AM
Do

    pcall(function()
        game:GetService("Players").LocalPlayer.Character:findFirstChild("Shirt"):Destroy()
    end)
Report Abuse
iStone4S is not online. iStone4S
Joined: 07 May 2012
Total Posts: 416
24 Apr 2013 07:07 AM
Voxility's way is my preferred way.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
24 Apr 2013 01:55 PM
*facepalm*

Well I figured it was a simple error.
Also, would :WaitForChild("Shirt") be more ideal, since if the shirt hasn't been created yet the script will just proceed on...

~ The ATR Fishie ~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image