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: Help!

Previous Thread :: Next Thread 
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 04:29 PM
character = game.Parent.Character

character.Shirt:Destroy()
if Shirt == nil then --How do i make it do nothing?
character.Pants:Destroy()
if Pants == nil then --How do i make it do nothing?
Shirt = Instance.new("Shirt", script.Parent.Parent.Parent.Parent.Parent.Character)
Pants = Instance.new("Pants", script.Parent.Parent.Parent.Parent.Parent.Character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"

Anyways im trying to make it where if someone does not have a shirt or pants on then i want to make it just go on to the next line of code, How do i do that?
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 04:34 PM
b1
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 04:38 PM
--Make sure you put this in a localscript, in either StarterGui or StarterPack
player = game.Players.LocalPlayer
character = game.Players:GetPlayerFromCharacter(player)

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()
end

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()
end

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
02 Sep 2014 04:39 PM
function changeclothes(character)
if character:FindFirstChild("Shirt") then
character:FindFirstChild("Shirt"):Destroy()
end
if character:FindFirstChild("Pants") then
character:FindFirstChild("Pants"):Destroy()
end
INSERT THE SHIRTS HERE

end
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
02 Sep 2014 04:40 PM
its gonna do what you want automatically homie, it might error at the top if the person doesn't have a shirt tho

btw your gonna have to name the pants and shirts
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 04:40 PM
--Whoops. Make an error. try this
player = game.Players.LocalPlayer
character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()
end

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()
end

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 04:51 PM
@unholy, Does it have to be in a local script? Because im making it a ontouch thing, want me to give you the whole script?
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 04:55 PM
Yes, please post the script.
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 04:57 PM
modelname="PjChange"



function touch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
player = game.Players.LocalPlayer(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true
wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"






local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:01 PM
--Try this and see if it works.

modelname="PjChange"

function touch(hit)
if hit.Parent:FindFirstChild("Humanoid") then

if game.Players:FindFirstChild(hit.Parent) == nil then return end

player = game.Players:FindFirstChild(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true

wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"


local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:05 PM
Now the text wont show up :l
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:07 PM
--try this. I think I fixed it

modelname="PjChange"

function touch(hit)
if hit.Parent:FindFirstChild("Humanoid") then

if game.Players:FindFirstChild(hit.Parent.Name) == nil then return end

player = game.Players:FindFirstChild(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true

wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"


local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:09 PM
Still nothing, btw im playin in play solo
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:12 PM
-- Run this and tell me what prints in the output.

modelname="PjChange"

function touch(hit)
print("Part Touched!")
if hit.Parent:FindFirstChild("Humanoid") then
print("Humanoid found!")
if game.Players:FindFirstChild(hit.Parent.Name) == nil then print("Player not found") return end
print("Player found!")
player = game.Players:FindFirstChild(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true

wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"


local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:13 PM
Just disconnected event because of exception
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:17 PM
--Maybe this will work...

modelname="PjChange"

function touch(hit)

if hit.Parent:FindFirstChild("Humanoid") then

player = game.Players:GetPlayerFromCharacter(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true

wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"


local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:21 PM
Worked but no clothing :l sorry if this is frustrating you
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
02 Sep 2014 05:22 PM
maybe if you didn't ignore my first post you would have clothing you ass
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:24 PM
I read it, stop being a jerk
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
02 Sep 2014 05:25 PM
then why are you having trouble with the shirts?

NAME THE SHIRT AND THE PANTS BEFORE SETTING THE TEMPLATE
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:25 PM
--Try this, I moved some of the ends around. And its really no problem at all.

modelname="PjChange"

function touch(hit)

if hit.Parent:FindFirstChild("Humanoid") then

player = game.Players:GetPlayerFromCharacter(hit.Parent)

player.PlayerGui.Text.Frame.TextLabel.Text = "Hey Ness, are you okay? Good, I bet that really startled you. I'm guessing you want to check it out, just change out of your pajamas first."

player.PlayerGui.Text.Frame.Visible = true

wait(8)

player.PlayerGui.Text.Frame.Visible = false

--- Below

character = player.Character

if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()
end

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()
end

--- Above

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"

local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("The teleporter aint there foo!")
end
end
end
end
script.Parent.Touched:connect(touch)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 05:28 PM
IT WORKED! THANKS SO MUCH :D :D :D :D
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
02 Sep 2014 05:29 PM
No problem!

Glad to help :)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 06:01 PM
Lol now i have this that wont work

player = game.Parent
character = player.Character
game.Players.PlayerAdded:connect(function(player)
if character:FindFirstChild("Shirt") ~= nil then
character.Shirt:Destroy()
end

if character:FindFirstChild("Pants") ~= nil then
character.Pants:Destroy()
end

Shirt = Instance.new("Shirt", character)
Pants = Instance.new("Pants", character)
Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=76625523"
Pants.PantsTemplate = "http://www.roblox.com/asset/?id=168536843"
end)
Report Abuse
theGOLDENidol is not online. theGOLDENidol
Joined: 11 Apr 2011
Total Posts: 787
02 Sep 2014 07:55 PM
Bump.
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