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: GUI / Value Help Please

Previous Thread :: Next Thread 
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 10:10 PM
I'm having some trouble with my scripts (as usual :/ )

Unfortunately, I couldn't find a patch with my current understanding of Lua. My main mistake, was making this two scripts, is there a way to make it into one?

HOW IT SHOULD WORK: When the GUI is clicked, it should decrease the value of the "Battery" and increase the brightness of a light located in a hat a player is given on joining. The hat works, it's been tested with other GUIs that work like this; though they turn the light on and off. It should turn the light on (if it's off, which is simply calculated using enabled), increase the brightness, then after a set number of time, put it back to the original upon clicking the button.

function die()
if script.Parent.Parent.Battery.Value > 1 then
script.Parent.Parent.Battery.Value = script.Parent.Parent.Battery.Value -1
script.Parent.Over:play()
end

script.Parent.MouseButton1Down:connect(die)
end

--------------------------------------------------------

function crap()
player = game.Players.LocalPlayer

if script.Parent.Parent.Battery.Value > 1 and player.Character then
script.Parent.Parent.Parent.Parent.Character.Test.Handle.Spotlight.Range = 24
script.Parent.Parent.Parent.Parent.Character.Test.Handle.Spotlight.Brightness = 3
wait(10)
script.Parent.Parent.Parent.Parent.Character.Test.Handle.Spotlight.Range = 16
script.Parent.Parent.Parent.Parent.Character.Test.Handle.Spotlight.Brightness = 1
end
end

script.Parent.MouseButton1Down:connect(crap)

---------------

Feel free to laugh at my horrible coding.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 10:20 PM
The two issues are

#1 Brightness and range aren't changing.

#2 Value of Battery isn't decreasing by one every time the button is hit.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:02 PM
bump :c
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:06 PM
this script looks incomplete. what is player?
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:12 PM
@ash

It's only half of the total number of scripts working in unison to complete the task.

The player is simply the player, and the "Test.Handle" is the hat they wear, that's been resolved by another script, and should be well ignored.

This is a complete script, it just needs patching.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:17 PM
1st script: there's an extra end there.

is that supposed to be there?
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:25 PM
Apparently, the game seems to want it.

Now, I can easily merge these scripts. They both contain the same function basis, combining the code isn't difficult...

Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:28 PM
for the first part of the script the end at the end( :3) should go before the connection so that part of the script can work.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:29 PM
oh really? I'll try it.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:30 PM
The light alterations don't want to work though, I can't understand why either...
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:33 PM
make sure those script.Parent.Parent...etc are correct and player.Character...well I like use player:findFirstChild("Character")~=nil then
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:36 PM
The character works fine during my testing.

I've tested similar scripts in this multiple times, I'm just unsure of what's wrong with the lighting. It says it can't find the spotlight, yet it can for everything else.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:37 PM
This doesn't work either, it resolves around the same problems.
It won't decrease the value by one.

function ded()
player = game.Players.LocalPlayer

noob = script.Parent.Parent.Battery.Value

if script.Parent.Parent.Battery.Value > 1 and player.Character then
player.Character.Humanoid.Health = 100
noob = noob - 1
script.Parent.Warning:play()
end
end

script.Parent.MouseButton1Down:connect(ded)
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:38 PM
do a solo test with yourself and check the output
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:41 PM
I'm watching and reviewing. Output shows nothing for lighting issues and battery value changes

Yet neither of them do anything.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:43 PM
Oh, finally.

I fixed something on my own.

The battery count script now successfully works.

The values drop respectfully, but the lighting still doesn't work.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:48 PM
Now, the lighting is showing some inconclusive results.

saying it can't locate the light. Possibly I messed up to location search.

"
00:47:54.799 - attempt to call a nil value
00:48:05.764 - Spotlight is not a valid member of Part
00:48:05.765 - Script 'Players.Player1.PlayerGui.ControlGUI.OVERCHARGE(WIP).SPY', Line 5
00:48:05.765 - stack end
00:48:05.765 - Disconnected event because of exception
"
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:48 PM
well I didn't find anything wrong with the second one. Umm. keep looking it over.
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:54 PM
Okay, did a bit more and got it to partially work now..

Seems to turn on successfully and increase brightness and range, but fails to reset it after 10 seconds.

function crap()
player = game.Players.LocalPlayer

if script.Parent.Parent.Battery.Value > 0 and player.Character then
script.Parent.Parent.Parent.Parent.Character.Test.Handle.SpotLight.Enabled = true
script.Parent.Parent.Parent.Parent.Character.Test.Handle.SpotLight.Brightness = 2
script.Parent.Parent.Parent.Parent.Character.Test.Handle.SpotLight.Range = 32
wait(10)
script.Parent.Parent.Parent.Parent.Character.Test.Handle.SpotLight.Brightness = 1
script.Parent.Parent.Parent.Parent.Character.Test.Handle.SpotLight.Range = 16
end
end

script.Parent.MouseButton1Down:connect(crap)
Report Abuse
denty315 is not online. denty315
Joined: 12 Oct 2008
Total Posts: 16937
19 Oct 2013 11:56 PM
Oi, now it seems to be working,

Strange.

Well, I'll send you a link to the game via messaging and you can see what I've been working on :p

if you want to that is
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
19 Oct 2013 11:57 PM
sure.
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