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: What is wrong with this script?

Previous Thread :: Next Thread 
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 09:15 PM
I spent a lot of time making this and it's not working. What is wrong?
-------------------------------------------------------------------------------------------
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local brick = workspace.questbrick1
local brickActive = true
local stats = Player:FindFirstChild('leaderstats')
if not stats then return end
local money = stats:FindFirstChild('Money')
if not money then return end
brick.Touched:connect(function(Hit)
if not brickActive then return end
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player and Player:findFirstChild("PlayerGui") then
brickActive = false
Player.PlayerGui.ScreenGui1.Frame.Visible = true
local yes = Player.PlayerGui.ScreenGui1.Frame.button1
local no = Player.PlayerGui.ScreenGui1.Frame.button2
local gui3 = Player.PlayerGui.ScreenGui3
function onClicked(yes)
gui3.TextButton.Text = "Quest: Get 3 pieces of wood and a hammer and talk to the explorer."
Player.PlayerGui.ScreenGui1.Frame1.Visible = false
end
yes.MouseClick:connect(onClicked)
Player.PlayerGui.ScreenGui1.Frame2.Visible = true
local yes1 = Player.PlayerGui.Frame2.button1
function onClicked(yes1)
if Player.PlayerGui.woodvalue.Value >= 3 then
Player.PlayerGui.woodvalue.Value = Player.PlayerGui.woodvalue.Value - 3
Money.Value = Money.Value + 100
Player.PlayerGui.ScreenGui1.Frame2.Visible = false
end
yes1.MouseClick:connect(onClicked)
end
function onClicked(no)
Player.PlayerGui.ScreenGui1.Frame1.Visible = false
end
no.MouseClick:connect(onClicked)
brickActive = true
end
end)
----------------------------------------------------------------------
Help?
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
19 Oct 2013 09:19 PM
And I'm gonna spend a lot of time on this if you don't post the output ty.
Report Abuse
Tomthebomb456 is not online. Tomthebomb456
Joined: 21 Sep 2010
Total Posts: 429
19 Oct 2013 09:20 PM
Hmm, seems like 'hit' isn't a valid value... I don't understand...
Report Abuse
Tomthebomb456 is not online. Tomthebomb456
Joined: 21 Sep 2010
Total Posts: 429
19 Oct 2013 09:20 PM
Output: local Player = game.Players:GetPlayerFromCharacter(Hit.Pare:1: attempt to index global 'Hit' (a nil value)
04:16:38.598 - Script 'local Player = game.Players:GetPlayerFromCharacter(Hit.Pare', Line 1
04:16:38.599 - stack end
Report Abuse
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 09:22 PM
What do you mean output? What it is supposed to do?
Report Abuse
Tomthebomb456 is not online. Tomthebomb456
Joined: 21 Sep 2010
Total Posts: 429
19 Oct 2013 09:24 PM
It says what the problem is... Nor really so good but it tells you what line that is wrong...
Report Abuse
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 09:26 PM
So what should I do?
Report Abuse
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 09:30 PM
Output: local Player = game.Players:GetPlayerFromCharacter(Hit.Pare:1: attempt to index global 'Hit' (a nil value)
04:16:38.598 - Script 'local Player = game.Players:GetPlayerFromCharacter(Hit.Pare', Line 1
04:16:38.599 - stack end
Report Abuse
Tomthebomb456 is not online. Tomthebomb456
Joined: 21 Sep 2010
Total Posts: 429
19 Oct 2013 09:31 PM
Look up line 1... It says it is something wrong with it... I can't tell what... (Maybe 10 too, since it's the same).
Well, I don't know anything about scripting, I can't even make a teleport script...

attempt to index global 'Hit' (a nil value)

~Take some beans and stay calm.
Report Abuse
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 09:59 PM
Bump
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Oct 2013 10:09 PM
local brick = workspace.questbrick1
local brickActive = true
brick.Touched:connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local stats = Player:FindFirstChild('leaderstats')
if not stats then return end
local money = stats:FindFirstChild('Money')
if not money then return end
if Player and Player:findFirstChild("PlayerGui") then
brickActive = false
Player.PlayerGui.ScreenGui1.Frame.Visible = true
local yes = Player.PlayerGui.ScreenGui1.Frame.button1
local no = Player.PlayerGui.ScreenGui1.Frame.button2
local gui3 = Player.PlayerGui.ScreenGui3
function onClicked(yes)
gui3.TextButton.Text = "Quest: Get 3 pieces of wood and a hammer and talk to the explorer."
Player.PlayerGui.ScreenGui1.Frame1.Visible = false
end
yes.MouseClick:connect(onClicked)
Player.PlayerGui.ScreenGui1.Frame2.Visible = true
local yes1 = Player.PlayerGui.Frame2.button1
function onClicked(yes1)
if Player.PlayerGui.woodvalue.Value >= 3 then
Player.PlayerGui.woodvalue.Value = Player.PlayerGui.woodvalue.Value - 3
Money.Value = Money.Value + 100
Player.PlayerGui.ScreenGui1.Frame2.Visible = false
end
yes1.MouseClick:connect(onClicked)
end
function onClicked(no)
Player.PlayerGui.ScreenGui1.Frame1.Visible = false
end
no.MouseClick:connect(onClicked)
brickActive = true
end
end)

What is your favorite ROBLOX game genre? Go here to take the survey!: goo(DOT)gl/3U8zNK
Report Abuse
Dandude300 is not online. Dandude300
Joined: 04 Jan 2013
Total Posts: 2501
19 Oct 2013 10:13 PM
logging probability 0.80837427900021
not logging
20:12:41.289 - DataModel Loading roblox.com/asset/?id=(somenumber)
Streaming Memory Multiplier Loaded
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
19 Oct 2013 10:15 PM
That's not a bad output. So I would have no idea what's wrong.

What is your favorite ROBLOX game genre? Go here to take the survey!: goo(DOT)gl/3U8zNK <-- sig
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