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: Strange..

Previous Thread :: Next Thread 
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:34 PM
function scoreHandler()

local score = game.Players.LocalPlayer.PlayerGui.Main.Level.Score

if score.Value == 90 or score.Value < 90 then
print("Level 1 complete!")
playerSub()
createPTNLFRAME()
end
end

It doesn't work at all. There is not output. All it does is call the functions and print but it doesn't check to see if the value of score is equal to or greater than 90.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
27 Jun 2013 11:36 PM
Well first of all, change your if statement to this:
if score.Value >= 90 then

Also, the problem isn't in this block of code.

Try uploading a bit of the playerSub() and createPTNLFRAME() functions, if they aren't too long.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:36 PM
This is not the full script btw.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:37 PM
Didn't work.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:39 PM
function scoreHandler()

local score = game.Players.LocalPlayer.PlayerGui.Main.Level.Score

if score.Value >= 90 then
print("Level 1 complete!")
playerSub()
createPTNLFRAME()
end
end

function playerSub()

local psp = game.Players.LocalPlayer.PlayerGui.Main.Level
local ps = game.Players.LocalPlayer.PlayerGui.Main.Level.Player
local psc = ps:Clone()

psc.Parent = psp
psc.Name = "pending"
ps.Visible = false
end

function createPTNLFRAME()

local ptnlp = game.Players.LocalPlayer.PlayerGui.Main.Level
local ptnl = Instance.new("Frame", ptnlp)

ptnl.Name = "PTNL"
ptnl.Position = UDim2.new(0, 400, 0, 200)
ptnl.Size = UDim2.new(0, 400, 0 , 200)
ptnl.BackgroundColor = BrickColor.new("White")
ptnl.ZIndex = 10
ptnl.BackgroundTransparency = 0.2

local t = Instance.new("TextLabel", ptnl)

t.Name = "congrats"
t.Position = UDim2.new(0, 200, 0, 10)
t.Size = UDim2.new(0, 0, 0 ,0)
t.Text = "Congrats!"
t.Font = "Arial"
t.FontSize = 7
t.ZIndex = 10

local tc = t:Clone()
tc.Parent = ptnl
tc.Name = "paragraph"
tc.Position = UDim2.new(0, 200, 0, 50)
tc.Text = "Congratulations, press okay to proceed to the next"
tc.FontSize = 6
local tc2 = t:Clone()
tc2.Parent = ptnl
tc2.Name = "paragraph2"
tc2.FontSize = 6
tc2.Text = "level, or press cancel to leave the game."
tc2.Position = UDim2.new(0, 200, 0, 65)

local o = Instance.new("TextButton", ptnl)

o.Name = "Okay"
o.Text = "Okay"
o.Position = UDim2.new(0, 250, 0, 110)
o.Size = UDim2.new(0, 90, 0, 30)
o.ZIndex = 10
o.BackgroundColor = BrickColor.new("White")

local c = o:Clone()

c.Parent = ptnl
c.Name = "Cancel"
c.Text = "Cancel"
c.Position = UDim2.new(0, 50, 0, 110)

sound()

local easy = game.Players.LocalPlayer.PlayerGui.Main
local soundVar1 = easy.MainFrame.Play.SoundNoise
local lvlChange = easy.Level.levelTitle
local ptnlRemover = easy.Level.PTNL
local subRemover = easy.Level.pending
local playerVisible = easy.Level.Player

o.MouseButton1Click:connect(function()
soundVar1:Play()
lvlChange.Text = "Level 2"
ptnlRemover:remove()
subRemover:remove()
playerVisible.Visible = true
playerVisible.Position = UDim2.new(0, 620, 0, 400)
end)

sound()

local menu = game.Players.LocalPlayer.PlayerGui.Main.MainFrame
local clvl = game.Players.LocalPlayer.PlayerGui.Main.Level

c.MouseButton1Click:connect(function()
soundVar1:Play()
menu.Visible = true
clvl:remove()
stop()
end)
end
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:40 PM
bump
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:42 PM
bumpx2
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:43 PM
bumpx3
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:45 PM
bumpx4

I really need to find the solution to this, because I cant have a bug messing up my game engine.
Report Abuse
RobTheHobo is not online. RobTheHobo
Joined: 09 Apr 2013
Total Posts: 1374
27 Jun 2013 11:45 PM
Bumpx4
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
27 Jun 2013 11:45 PM
Gimme a min, this'll take a bit to sift through.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
27 Jun 2013 11:46 PM
Okay : ]
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
27 Jun 2013 11:56 PM
Okay first, listen:
- This code is really messy, and I don't have time to clean it up for you
- Work on reusing variables when you can; you've created several of the same ones
- Use variable names that _make_sense_, this was hard to understand
- Don't put spaces where it won't help organize things - it makes it messy
- Use indentations to organize different levels of your code.
- Read this:
http://wiki.roblox.com/index.php/Writing_Clean_Code

It will REALLY help you in the future. Anyways, try this:

function scoreHandler()

local score = game.Players.LocalPlayer.PlayerGui.Main.Level.Score

if score.Value >= 90 then
print("Level 1 complete!")
playerSub()
createPTNLFRAME()
end
end

function playerSub()

local psp = game.Players.LocalPlayer.PlayerGui.Main.Level
local ps = game.Players.LocalPlayer.PlayerGui.Main.Level.Player
local psc = ps:Clone()

psc.Parent = psp
psc.Name = "pending"
ps.Visible = false
end

function createPTNLFRAME()

local ptnlp = game.Players.LocalPlayer.PlayerGui.Main.Level
local ptnl = Instance.new("Frame", ptnlp)

ptnl.Name = "PTNL"
ptnl.Position = UDim2.new(0, 400, 0, 200)
ptnl.Size = UDim2.new(0, 400, 0 , 200)
ptnl.BackgroundColor = BrickColor.new("White")
ptnl.ZIndex = 10
ptnl.BackgroundTransparency = 0.2

local t = Instance.new("TextLabel", ptnl)

t.Name = "congrats"
t.Position = UDim2.new(0, 200, 0, 10)
t.Size = UDim2.new(0, 0, 0 ,0)
t.Text = "Congrats!"
t.Font = "Arial"
t.FontSize = 7
t.ZIndex = 10

local tc = t:Clone()
tc.Parent = ptnl
tc.Name = "paragraph"
tc.Position = UDim2.new(0, 200, 0, 50)
tc.Text = "Congratulations, press okay to proceed to the next"
tc.FontSize = 6
local tc2 = t:Clone()
tc2.Parent = ptnl
tc2.Name = "paragraph2"
tc2.FontSize = 6
tc2.Text = "level, or press cancel to leave the game."
tc2.Position = UDim2.new(0, 200, 0, 65)

local o = Instance.new("TextButton", ptnl)

o.Name = "Okay"
o.Text = "Okay"
o.Position = UDim2.new(0, 250, 0, 110)
o.Size = UDim2.new(0, 90, 0, 30)
o.ZIndex = 10
o.BackgroundColor = BrickColor.new("White")

local c = o:Clone()

c.Parent = ptnl
c.Name = "Cancel"
c.Text = "Cancel"
c.Position = UDim2.new(0, 50, 0, 110)

sound()

local easy = game.Players.LocalPlayer.PlayerGui.Main
local soundVar1 = easy.MainFrame.Play.SoundNoise
local lvlChange = easy.Level.levelTitle
local ptnlRemover = easy.Level.PTNL
local subRemover = easy.Level.pending
local playerVisible = easy.Level.Player

o.MouseButton1Click:connect(function()
soundVar1:Play()
lvlChange.Text = "Level 2"
ptnlRemover:remove()
subRemover:remove()
playerVisible.Visible = true
playerVisible.Position = UDim2.new(0, 620, 0, 400)
end)

c.MouseButton1Click:connect(function()
soundVar1:Play()
easy.MainFrame.Visible = true
easy.Level:remove()
end)

end
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:00 AM
May I ask what you changed?
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Jun 2013 12:02 AM
The whole thing with the random 'sound' function - it was really unnecessary and had a few bugs in it.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:03 AM
There must be another problem then, and sorry for the messy code ;P.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Jun 2013 12:08 AM
Do you mean it still doesn't work?
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:08 AM
I guess there is no solution D:
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:08 AM
Yep
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:09 AM
And, I don't want to post the full script from the fear that others might steal it :P
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Jun 2013 12:09 AM
I suggest looking over your paths to object - and I mean all of them, carefully - to make sure they're all right. Also, what's happening? It's just not recognizing when the score goes past 90?
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:10 AM
Yes
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
28 Jun 2013 12:14 AM
Maybe this function has something to do with it?

Sorry for the messy code Dx


function createLevel()

local fP = game.Players.LocalPlayer.PlayerGui.Main
local levelFrame = Instance.new("Frame", fP)

levelFrame.Name = "Level"
levelFrame.Position = UDim2.new(0, 0, 0, 0)
levelFrame.Size = UDim2.new(0, 5000, 0, 5000)
levelFrame.BackgroundColor = BrickColor.new("White")
levelFrame.ZIndex = 1

local title = Instance.new("TextLabel", fP.Level)

title.Name = "levelTitle"
title.Position = UDim2.new(0, 500, 0, 50)
title.Size = UDim2.new(0, 100, 0, 100)
title.Text = "Level 1"
title.Font = "Arial"
title.FontSize = 8
title.TextColor3 = Color3.new(0, 0, 0)
title.ZIndex = 2
title.BackgroundTransparency = 1

local num = Instance.new("NumberValue", fP.Level)

num.Name = "Score"
num.Value = 0

local lol = 0

local txt = title
local txtCopy = txt:Clone()
txtCopy.Parent = fP.Level
txtCopy.Name = "MovesCounter"
txtCopy.Position = UDim2.new(0, 690, 0, 50)
createPlayer()
scoreHandler()
repeat
wait(.1)
txtCopy.Text = ("Moves: "..num.Value)
until lol >= 1
print("You win!")

end
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Jun 2013 12:15 AM
Hold on I'll do some stuff
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Jun 2013 12:18 AM
I'm gonna rewrite this thing.
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