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: Magnitude (what is wrong with this? :/)

Previous Thread :: Next Thread 
MrCherrys is not online. MrCherrys
Joined: 28 Apr 2010
Total Posts: 13469
29 Aug 2014 03:39 PM
Well, basically I'm trying to make it so that when the client goes near the brick, the GUI appears with transparency but all it does is flashes when I join the game. And hwne you go away from the brick, the GUI goes away with transparency.

Do you know what's wrong with this? No Output.



button = script.Parent

while true do
for i,v in pairs(game.Players:GetPlayers()) do
if (v.Character.Torso.Position - button.Position).magnitude <= 5 then
for GuiReveal = 1, 0, -0.05 do
v.PlayerGui.InstructionGui.Label.TextTransparency = GuiReveal
wait()
end
end
if (v.Character.Torso.Position - button.Position).magnitude >= 5 then
for GuiReveal = 0, 1, 0.05 do
v.PlayerGui.InstructionGui.Label.TextTransparency = GuiReveal
wait()
end
end
end
wait()
end
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
29 Aug 2014 03:41 PM
It's simple.

Read your code with more depth. There's a loop running almost every frame. And as long as the player from the first for loop is in the magnitude, ANOTHER LOOP is created to animate the GUI transparency. EVERY TIME THE LOOP RUNS

So it's created a new loop to animate almost every 1/30th second you are in range.
Report Abuse
MrCherrys is not online. MrCherrys
Joined: 28 Apr 2010
Total Posts: 13469
29 Aug 2014 03:46 PM
Well, tbh I don't understand anything about scripting but I'm pretty intermedite (fail spell I guess) at scripting. Could you maybe modify it or somewhat?
Report Abuse
MrCherrys is not online. MrCherrys
Joined: 28 Apr 2010
Total Posts: 13469
29 Aug 2014 04:07 PM
Someone please help!
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
29 Aug 2014 04:08 PM
button = script.Parent

while true do
for i,v in pairs(game.Players:GetPlayers()) do;Spawn(wait)
if (v.Character.Torso.Position - button.Position).magnitude <= 5 then
for GuiReveal = 1, 0, -0.05 do
v.PlayerGui.InstructionGui.Label.TextTransparency = GuiReveal
wait()
end
end
if (v.Character.Torso.Position - button.Position).magnitude >= 5 then
for GuiReveal = 0, 1, 0.05 do
v.PlayerGui.InstructionGui.Label.TextTransparency = GuiReveal
wait()
end
end
end
wait()
end
Report Abuse
MrCherrys is not online. MrCherrys
Joined: 28 Apr 2010
Total Posts: 13469
29 Aug 2014 04:36 PM
Doesn't work like that. My output says that the symbol ';' is unexpected.
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