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 » Scripters
Home Search
 

Re: Is there a more efficient way to do this?

Previous Thread :: Next Thread 
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
02 Feb 2015 09:26 AM
so I made a hopperbin that makes your character transparent, and floaty

however, once the character turns back to normal from his transparency, his torso is like blue and stuff, why is that? is there any other way to prevent that?

also, for the floaty part, i used a body velocity and i put it inside of the character's torso. any other way to get that same floaty effect as well? the function that handles transparency is the spookify function, and the function that handles floating is inside of the jumping function

preferably i only wanted their jumps to be floaty but yeah

here's the script

bin = script.Parent -- the hopperbin itself
event = bin:WaitForChild("RemoteEvent")
delayTime = 5

local function spookify(player, transparency)
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
if char and humanoid and humanoid.Health > 0 then
for i, v in pairs (char:GetChildren()) do
if v:IsA("Part") then
v.Transparency = transparency
end
end
end
end

local function jumping(player)
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
if char and humanoid and humanoid.Health > 0 then
--does floaty stuff there
bodyvel = Instance.new("BodyVelocity")
bodyvel.Parent = char:FindFirstChild("Torso")
bodyvel.velocity = Vector3.new(0,4,0)
bodyvel.maxForce = Vector3.new(0,10000,0)

local spookysound = Instance.new("Sound")
spookysound.Parent = char:FindFirstChild("Torso")
spookysound.SoundId = "rbxasset://sounds/HalloweenGhost.wav"
spookysound.Pitch = 1
spookysound.Volume = 0.7
spookysound.PlayOnRemove = true
spookysound:Destroy()
end
end

local function unspookify(player, transparency)
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
if char and humanoid and humanoid.Health > 0 then
for i, v in pairs(char:GetChildren())do
if v:IsA("Part") then
v.Transparency = transparency
bodyvel:Destroy()
end
end
end
end


bin.Selected:connect(function()
event.OnServerEvent:connect(function(player, ...)
if player then
local tuple = {...}
if tuple[2] == "KeyPressed" then
local keyPressed = tuple[3]
if keyPressed == "g" then
print("spookifying")
wait()
spookify(player, 0.5)
jumping(player)
wait(delayTime)
unspookify(player, 0
end
end
end
end)
end)


Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
02 Feb 2015 09:29 AM
*unspookify(player, 0)

whoops, accidentally deleted that extra ) when deleting a comment
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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