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
 

This should work, but it doesn't.

Previous Thread :: Next Thread 
Kierantech909 is not online. Kierantech909
Joined: 04 Jul 2009
Total Posts: 818
29 Jul 2013 03:02 PM
Ok, basically, it's obviously registered the Item1, Item2 and Item3 buttons, because the MouseEnter event triggers flawlessly. What I want to know is... why does the MouseButton1Down not trigger? Seriously, the line right after the function's event trigger is defined does not run, let alone the rest of the function. No errors, either. It works for all the buttons except Item1, Item2 and Item3. Here's the script:

for basenumber,basedata in pairs(buttonframes) do
for number,data in pairs(basedata:GetChildren()) do
if data:IsA("TextButton") then
data.MouseEnter:connect(function()
sounds.ButtonEnter:Play()
local highlight = basedata.DecorationFrame.HighlightFrame
highlight:TweenPosition(UDim2.new(0.25,-150,data.Position.Y.Scale,data.Position.Y.Offset),"Out","Linear",0.1,true)
for subnumber,subdata in pairs(basedata:GetChildren()) do
if subdata == data then
subdata.TextStrokeTransparency = 0
elseif subdata:IsA("TextButton") then
subdata.TextStrokeTransparency = 1
if subdata:FindFirstChild("Price") and subdata.Price:IsA("TextButton") then
subdata.Price.Visible = false
end
end
end
if data:FindFirstChild("Price") and data.Price:IsA("TextButton") then
data.Price.Visible = true
end
wait(0.1)
local dcol = data.TextStrokeColor3
highlight.BackgroundColor3 = Color3.new(dcol.r,dcol.g,dcol.b)
end)
data.MouseButton1Down:connect(function()
sounds.ButtonClick:Play()
if data.Name == "PlayButton" then
if playdb == false then
playdb = true
introframe.Visible = false
for number,data in pairs(bannedlist) do
if plr.Name == data then
lockedout = true
end
end
if lockedout == false then
charSetup()
else
loadingframe.Visible = false
errorframe.Visible = true
end
end
elseif data.Name == "Exit" then
basedata.Visible = false
hudframe.Visible = true
elseif data.Name == "Item1" or data.Name == "Item2" or data.Name == "Item3" then
for number1,data1 in pairs(game.Lighting.GameArchives.Tools:GetChildren()) do
for number2,data2 in pairs(data1:GetChildren()) do
for number3,data3 in pairs(char:GetChildren()) do
if data.Text == data2.Name and plr.PlayerStats.cR.Value >= data.PriceNum.Value then
if data3:FindFirstChild("Location") then
local purchasedobj = data2
local mesh = purchasedobj:FindFirstChild(purchasedobj.Name):Clone()
if data3.Location.Value ~= mesh.Location.Value then
mesh.Parent = char
mesh.ObjSetup.Disabled = false
else
mesh:Destroy()
end
end
end
end
end
end
end
end)
end
end
end

By the way, YES, everything IS defined. Otherwise, I would have seen an error. Like I said before, there have been no errors. Not a single one.

~Kierantech909
Report Abuse
Phyclops is not online. Phyclops
Joined: 27 Sep 2012
Total Posts: 5895
29 Jul 2013 03:03 PM
@mini
"Like I said before, there have been no errors. Not a single one."
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
29 Jul 2013 03:04 PM
function click()
for basenumber,basedata in pairs(buttonframes) do
for number,data in pairs(basedata:GetChildren()) do
if data:IsA("TextButton") then
data.MouseEnter:connect(function()
sounds.ButtonEnter:Play()
local highlight = basedata.DecorationFrame.HighlightFrame
highlight:TweenPosition(UDim2.new(0.25,-150,data.Position.Y.Scale,data.Position.Y.Offset),"Out","Linear",0.1,true)
for subnumber,subdata in pairs(basedata:GetChildren()) do
if subdata == data then
subdata.TextStrokeTransparency = 0
elseif subdata:IsA("TextButton") then
subdata.TextStrokeTransparency = 1
if subdata:FindFirstChild("Price") and subdata.Price:IsA("TextButton") then
subdata.Price.Visible = false
end
end
end
if data:FindFirstChild("Price") and data.Price:IsA("TextButton") then
data.Price.Visible = true
end
wait(0.1)
local dcol = data.TextStrokeColor3
highlight.BackgroundColor3 = Color3.new(dcol.r,dcol.g,dcol.b)
end)
data.MouseButton1Down:connect(function()
sounds.ButtonClick:Play()
if data.Name == "PlayButton" then
if playdb == false then
playdb = true
introframe.Visible = false
for number,data in pairs(bannedlist) do
if plr.Name == data then
lockedout = true
end
end
if lockedout == false then
charSetup()
else
loadingframe.Visible = false
errorframe.Visible = true
end
end
elseif data.Name == "Exit" then
basedata.Visible = false
hudframe.Visible = true
elseif data.Name == "Item1" or data.Name == "Item2" or data.Name == "Item3" then
for number1,data1 in pairs(game.Lighting.GameArchives.Tools:GetChildren()) do
for number2,data2 in pairs(data1:GetChildren()) do
for number3,data3 in pairs(char:GetChildren()) do
if data.Text == data2.Name and plr.PlayerStats.cR.Value >= data.PriceNum.Value then
if data3:FindFirstChild("Location") then
local purchasedobj = data2
local mesh = purchasedobj:FindFirstChild(purchasedobj.Name):Clone()
if data3.Location.Value ~= mesh.Location.Value then
mesh.Parent = char
mesh.ObjSetup.Disabled = false
else
mesh:Destroy()
end
end
end
end
end
end
end
end)
end
end
end
end
script.Parent.MouseButton1Down:connect(click)
Report Abuse
Kierantech909 is not online. Kierantech909
Joined: 04 Jul 2009
Total Posts: 818
29 Jul 2013 03:07 PM
@777MrEpic

I don't think moving the event trigger to after the function will do any good. My problem is that it works. But not for a select few buttons.

~Kierantech909
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
29 Jul 2013 03:08 PM
event
end
connection line
that is how it works
Report Abuse
Kierantech909 is not online. Kierantech909
Joined: 04 Jul 2009
Total Posts: 818
29 Jul 2013 03:12 PM
Ah, but there's another problem I didn't mention... I can't move the event trigger line down. Directly below, there's a while loop. From past experience, moving event triggers below loops prevents the triggers from firing. Also, like I said twice, the function DOES run. Just not for a couple of buttons. Said buttons are in the same tables that are checked, so it does register them. When you hover over the buttons, that function fires. Clicking them does nothing. Clicking other buttons works. If it was a case of me needing to move the event trigger down, wouldn't the entire function just not run at all?

~Kierantech909
Report Abuse
Kierantech909 is not online. Kierantech909
Joined: 04 Jul 2009
Total Posts: 818
29 Jul 2013 03:39 PM
What a turn of events. Shedletsky visited the game in question, guys! :D

~Kierantech909
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