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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Tables and ClassNames...

Previous Thread :: Next Thread 
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
30 Sep 2012 10:15 PM
wait(1)
plr = script.Parent.Parent.Parent.Parent.Parent
gui = script.Parent.Parent.Parent
char = plr.Character
cloaking = char.Cloaking
max = char.MaxCloak
chrg = char.Cloaked
mshld = char.MaxShields
shld = char.Shielded
running = false
OnDB = false
OffDB = false
ClickDB = false
function charge()
while wait(1) do
if running == false then
if chrg.Value < max.Value then
script.Parent.Low.BackgroundTransparency = 1
if chrg.Value == 10 then
script.Parent.Min:Play()
--char.CloakPack.Middle.Min:Play()
end
chrg.Value = chrg.Value + 1
end
end
end
end
thread=coroutine.create(charge)
assert(coroutine.resume(thread))

flopper = false
function gui()
while wait(.25) do
if running == true then
script.Parent.Charge:TweenSize(UDim2.new(1,0,-(chrg.Value/max.Value),0),1,0,.5)
else
script.Parent.Charge:TweenSize(UDim2.new(1,0,-(chrg.Value/max.Value),0),1,0,1)
end
if shld.Value < mshld.Value and running == true then
decloak()
end
if chrg.Value < 10 and running == true then
if flopper == false then
flopper = true
script.Parent.Low.BackgroundTransparency = .5
else
flopper = false
script.Parent.Low.BackgroundTransparency = 1
end
end
end
end
thread=coroutine.create(gui)
assert(coroutine.resume(thread))

function decloak()
cloaking.Value = false
script.Parent.Button.Text = "On"
if OffDB == false then
OffDB = true
script.Parent.Off:Play()
--char.CloakPack.Middle.Off:Play()
end
running = false
--script.DeCloakScript:Clone().Parent = char
for _,v in pairs(char:GetChildren()) do
if v.ClassName == "Part" then
if v.Name ~= "Head" and v.Name ~= "ShieldPart" and v.Name ~= "MeshShieldPart" then
v.Transparency = 0
end
elseif v.ClassName == "Hat" then
hndl = v:FindFirstChild("Handle")
if hndl ~= nil then
hndl.Transparency = 0
end
end
end
for _,w in pairs(char.CloakPack:GetChildren()) do
if w.ClassName == "Part" then
if w.Name ~= "Middle" then
w.Transparency = 0
end
end
end
wait(.5)
OffDB = false
end

function cloak()
cloaking.Value = true
if OnDB == false then
OnDB = true
--script.Parent.On:Play()
char.CloakPack.Middle.On:Play()
end
script.Parent.Button.Text = "Off"
--script.CloakScript:Clone().Parent = char
for _,v in pairs(char:GetChildren()) do
if v.ClassName == "Part" then
if v.Name ~= "Head" and v.Name ~= "ShieldPart" and v.Name ~= "MeshShieldPart" then
v.Transparency = .975
end
elseif v.ClassName == "Hat" then -- issue appears to be here
hndl = v:FindFirstChild("Handle")
if hndl ~= nil then
hndl.Transparency = .975
end
end
end
for _,w in pairs(char.CloakPack:GetChildren()) do
if w.ClassName == "Part" then
if w.Name ~= "Glow" and v.Name ~= "Middle" then
w.Transparency = .975
elseif w.Name == "Glow" then
w.Transparency = 1
end
end
end
wait(.5)
OnDB = false
end

function run()
cloaking.Value = true
while wait(.5) do
if chrg.Value <=0 or running == false or shld.Value < mshld.Value then
decloak()
break end
chrg.Value = chrg.Value - 1
ClickDB = false
end
end

function Click()
if ClickDB == false then
ClickDB = true
if running == false then
if chrg.Value >=10 and shld.Value >= mshld.Value then
running = true
cloak()
run()
else
script.Parent.Low.BackgroundTransparency = .5
wait(.125)
script.Parent.Low.BackgroundTransparency = 1
wait(.125)
script.Parent.Low.BackgroundTransparency = .5
wait(.125)
script.Parent.Low.BackgroundTransparency = 1
wait(.125)
script.Parent.Low.BackgroundTransparency = .5
wait(.125)
script.Parent.Low.BackgroundTransparency = 1
wait(.125)
script.Parent.Low.BackgroundTransparency = .5
wait(.125)
script.Parent.Low.BackgroundTransparency = 1
wait(.125)
end
else
decloak()
end
wait(.5)
ClickDB = false
end
end

script.Parent.Button.MouseButton1Down:connect(Click)





The script should work, I have gone over it more times than I can think.

All the defined objects exist, but it seems to not like the hat classname.



S-1894>(Supreme_Commander_of_Advanced_Zero)
Report Abuse
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
30 Sep 2012 10:20 PM
Look in the Cloak() function, as that is where the issue resides.

S-1894>(Supreme_Commander_of_Advanced_Zero)
Report Abuse
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
30 Sep 2012 10:34 PM
Can't anyone figure it out?


S-1894>(Supreme_Commander_of_Advanced_Zero)
Report Abuse
shred1894 is not online. shred1894
Joined: 30 Aug 2009
Total Posts: 6515
01 Oct 2012 01:58 AM
Turns out the code was fine, it just didn't like my localscript.



S-1894>(Supreme_Commander_of_Advanced_Zero)
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