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: Cloaking script

Previous Thread :: Next Thread 
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
29 Mar 2014 01:23 PM
I have a script that it gives you a tool that should cloak you, and it doesn't. Please help!

bin = script.Parent

backupFace = nil
backupShirt = nil
local hurtConnect = nil
local lastHealth = 0
local cloakValue= Instance.new("NumberValue")
cloakValue.Name = "CloakValue"
cloakValue.Value = 100
local isCloaked = false

function BlendTransparency(char, blendTo)
local c = char:GetChildren()
for ind, x in ipairs(c) do
if(x:IsA("Part")) then
x.Transparency = 0.5
end
if(x:IsA("Hat")) then
x.Handle.Transparency = 0.5
end
end
wait(0.5)
for ind, x in ipairs(c) do
if(x:IsA("Part")) then
x.Transparency = blendTo
end
if(x:IsA("Hat")) then
x.Handle.Transparency = blendTo
end
end
end

--[[function BlendTransparencyDown(char, blendTo)
local c = char:GetChildren()
for i=1, blendTo, -0.3 do
for ind, x in ipairs(c) do
if(x:IsA("Part")) then
x.Transparency = i
end
if(x:IsA("Hat")) then
x.Handle.Transparency = i
end
end
wait(0.1)
end
for ind, x in ipairs(c) do
if(x:IsA("Part")) then
x.Transparency = blendTo
end
if(x:IsA("Hat")) then
x.Handle.Transparency = blendTo
end
end
end]]--



function CloakFull()
isCloaked = true
if (hurtConnect ~= nil) then
hurtConnect:disconnect()
end
local player = game.Players.LocalPlayer
hurtConnect = player.Character.Humanoid.Changed:connect(function(prop)
if (player.Character.Humanoid.Health <= 0) then
Uncloak()
elseif (prop == "Health" and player.Character.Humanoid.Health < lastHealth) then
CloakFull()
end
lastHealth = player.Character.Humanoid.Health
end)
local player = game.Players.LocalPlayer
if player == nil then return end
local char = player.Character
local face = char.Head:FindFirstChild("face")
local shirt = char.Torso:FindFirstChild("roblox")
if (face ~= nil) then backupFace = face:Clone() end
if (shirt ~= nil) then backupShirt = shirt:Clone() end
BlendTransparency(char, 1)
if (face ~= nil) then char.Head.face.Parent = nil end
if (shirt ~= nil) then char.Torso.roblox.Parent = nil end
end

function Uncloak()
isCloaked = false
if (hurtConnect ~= nil) then
hurtConnect:disconnect()
hurtConnect = nil
end
local player = game.Players.LocalPlayer
if player == nil then return end
local char = player.Character
local face = char.Head:FindFirstChild("face")
local shirt = char.Torso:FindFirstChild("roblox")
if (face == nil and backupFace ~= nil) then backupFace.Parent = char.Head end
if (shirt == nil and backupShirt ~= nil) then backupShirt.Parent = char.Torso end
BlendTransparency(char, 0)
bin.Active = false
end

function onSelected(mouse)
local player = game.Players.LocalPlayer
if player == nil then return end
CloakFull()
lastHealth = player.Character.Humanoid.Health
cloakValue.Parent = player.Character
end

function onDeselected(mouse)
if (hurtConnect ~= nil) then
hurtConnect:disconnect()
hurtConnect = nil
end
if (isCloaked == true) then
Uncloak()
end
end

bin.Selected:connect(onSelected)
bin.Deselected:connect(onDeselected)

wait(1)

while true do
if (isCloaked == true) then
cloakValue.Value = cloakValue.Value - .50
if (cloakValue.Value <= 0) then
cloakValue.Value = 0
Uncloak()
end
else
cloakValue.Value = cloakValue.Value + 0.35
if (cloakValue.Value >= 100) then cloakValue.Value = 100 end
end
wait(0.1)
end
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
29 Mar 2014 02:23 PM
Please help! I don't know what's wrong with it
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
29 Mar 2014 02:24 PM
don't use free models.

#nerdsunited
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
29 Mar 2014 02:42 PM
I never used a free model, I am using someone else's uncopylocked place and I attempted to fix the script myself but was unable to. I want to make this game better, currently, I am building several more maps for it and adding more stuff daily. This is just a script that isn't working
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
29 Mar 2014 02:58 PM
I really need help D:
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
29 Mar 2014 03:51 PM
Someone please help me!
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
30 Mar 2014 10:16 AM
I figured out it was broken by an update.. ofcourse, now what do I need to do to fix it?
Report Abuse
GFXdylan is not online. GFXdylan
Joined: 09 Feb 2013
Total Posts: 679
30 Mar 2014 10:17 AM
you dont define clicked?
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
30 Mar 2014 10:21 AM
What do you mean? @ above
It's supposed to cloak you when you equip the tool
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
30 Mar 2014 10:39 AM
Micah, the script is fine. Try putting it in a local script, for future reference, server side scripts no longer work in hopperbins.
-=Robo=-
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
30 Mar 2014 12:46 PM
How do I put it into local script?
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
30 Mar 2014 12:47 PM
Create a localscript from the objects menu. Copy and paste your code into it and delete the original script that wasn't working, then test.

When life gives you lemons... BURN HIS HOUSE DOWN! >:D
Report Abuse
micahjames64 is not online. micahjames64
Joined: 16 Nov 2010
Total Posts: 154
30 Mar 2014 01:08 PM
THANK YOU SO MUCH, OMG, THANK YOU SOOOOOO MUCH
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