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 » Game Design
Home Search
 

Re: Why is this not working?

Previous Thread :: Next Thread 
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
30 Jun 2016 08:10 PM
Since parts don't have a MouseButton1Click event or whatnot, this was supposed to be my way of geting around that by not letting a function fire unless the mouse was pressed down and then let go on the same target.

The mousebutton down function works flawlessly, and the mousebutton up function only half works. The section about the Plot and construction gui works perfectly, but during the upgrade section, well... nothing happens. No errors, no fired function


Idk what's wrong. The code looks fine to me. I can't make heads or tails of the problem
I tried a print line just after the elseif statement but even that didnt print.

At this point, I am absolutely stuck. My game cannot be finished without this. It's part of the game's core function



local function CheckParent(Object) CurrentMouseSelection = nil
if Object.Parent.Name:match("rbxl") then return end
if Object.Parent.Name:match("Tower") and Object.Parent.Name ~= "Tower Base" then
CurrentMouseSelection = Object.Parent
else CheckParent(Object.Parent) end end


Mouse.Button1Down:connect(function(Object)
if CCC == false then CCC = true
if Mouse.Target ~= nil then
if Mouse.Target.Name == "Plot" then
CurrentMouseSelection = Mouse.Target
print(CurrentMouseSelection)
elseif Mouse.Target:IsA("BasePart") then
CheckParent(Mouse.Target)
print(CurrentMouseSelection)
end
end end end)

Mouse.Button1Up:connect(function()
if CCC == true then
if Mouse.Target ~= nil then
if Mouse.Target == CurrentMouseSelection then
if Mouse.Target.Name == "Plot" then
if Mouse.Target.Transparency == 0 then
if MUI:findFirstChild("Construction") then MUI.Construction:Destroy() end
if MUI:findFirstChild("Upgrader") then MUI.Upgrader:Destroy() end
PrepareConctructionGui(MUI, Mouse, CurrentMouseSelection)
end
elseif Mouse.Target:IsDescendantOf(CurrentMouseSelection) then
if MUI:findFirstChild("Construction") then MUI.Construction:Destroy() end
if MUI:findFirstChild("Upgrader") then MUI.Upgrader:Destroy() end
PrepareUpgradeGui(MUI, CurrentMouseSelection)
end
end
end
CCC = false end end)
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 09:14 AM
bump
Report Abuse
daireb is online. daireb
Joined: 16 Nov 2012
Total Posts: 726
01 Jul 2016 09:18 AM
This should be in scripters.
And, why aren't you using a mousedetector in the part?
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 09:33 AM
Because it doesn't work that way. I'd still have to use the check function to make sure the part's ancestor was a tower. I had this conversation with someone already.

And no, this is supposed to be here. I'll say it again,

Scripters Forum
This is the place for discussion about scripting. Anything about scripting that is not a help request or topic belongs here.

And also roblox had already officially stated that when they removed the old scripting helpers and building helpers forums that we were meant to post them here in Game Design from now on.


Why do I keep having to have this conversation over and over? I need help with that thing up above, not arguing about where it's supposed to be posted
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 09:37 AM
Look, I don't like asking for help. It puts me in very awkward situations. Sometimes I have an argument, sometimes people help me. Either way I die a little inside knowing I wasn't smart enough to fix the problem myself.

So can you PLEASE just help...?
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 11:28 AM
The CheckParent function works just fine. It sets the tower as the CurrentMouseSelection like it should, so when the mouse button is let go while still being on the same target, the elseif line should fire, but it's like it doesn't recognize it anymore. I don't know how to fix this one
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 01:54 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 02:51 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 04:23 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
01 Jul 2016 07:17 PM
bump
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 09:51 AM
bump
Report Abuse
TacticalEnemy is not online. TacticalEnemy
Joined: 30 Nov 2011
Total Posts: 4714
02 Jul 2016 10:03 AM
bump
Report Abuse
greenmaxy is online. greenmaxy
Joined: 15 Jun 2012
Total Posts: 330
02 Jul 2016 10:14 AM
Mouse is supposed to be mouse. No capital m.
Report Abuse
greenmaxy is online. greenmaxy
Joined: 15 Jun 2012
Total Posts: 330
02 Jul 2016 10:15 AM
Never mind i dno't think that's the issue
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 11:07 AM
I can't post the whole script though. I got an error saying it was too long.
I did define it as Mouse up at the top of the script, though. If someone were willing to help, I wouldn't mind putting it on codepad or something
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 11:10 AM
qQkXZPEC


Here, I put it on codepad. I know it's not the most efficient script, but I have a learning disability. After 8 years of roblox, this is literally the best I can do
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 11:12 AM
omfg it didn't even paste the whole thing into codepad
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 11:14 AM
There, the first and second half on codepad. Even codepad can't hold all of the lines :/

qQkXZPEC

DCrviusm
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 01:26 PM
bump
Report Abuse
GreatOculus is not online. GreatOculus
Joined: 30 Aug 2009
Total Posts: 2103
02 Jul 2016 01:38 PM
Use a click detector.

Also, while the scripters forum might be described like that on the roblox site, help request actually DO go in there, even if roblox says otherwise. Just go have a gander and you'll see that 95% of the posts in there are help requests.


Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
02 Jul 2016 06:09 PM
turned out I placed an end after the elseif condition in Button1Up when it should have come before
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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