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 » Scripters
Home Search
 

Re: i need help with this

Previous Thread :: Next Thread 
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 01:42 PM
can you not use the click function in this situation?




local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

while wait() do
if mouse.Target ~=nil and mouse.Target.Name == 'HoverBrick' then
script.Parent.Visible = true
script.Parent.Position = UDim2.new(0, ((mouse.X)-90), 0, ((mouse.Y)-20))

else script.Parent.Visible = false

end
end

function Click(mouse)
if script.Parent.Visible = true
then print("CLICKED!")
wait(1)
end

script.Parent.MouseButton1Down:connect(Click)




Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
03 Jan 2016 01:43 PM
Since your loop keeps repeating over and over again the script never gets to the part where it connects mouse clicking to the Click function.
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 01:44 PM
oh i thought the while true do was a separate function

thanks man

Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 01:46 PM
function Click(mouse)
if script.Parent.Visible = true
then print("CLICKED!")
wait(1)
end
missing end
Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 01:47 PM
Also use the spawn function.

spawn(function()
while wait() do
--while code here
end
end)
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 01:53 PM
still not working fml

the hover part is working perfectly but that clicking function never works and there's no errors

i tried your code but it's still broken

is it just not possible?



Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 01:53 PM
also what does the spawn function do

Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 01:56 PM
The spawn function would keep whatever's inside from delaying following code. Basically splits off two separate tracks of delay. I use it if I have multiple while loops or like you have.
Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 02:00 PM
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

spawn(function()
while wait() do
if mouse.Target ~=nil and mouse.Target.Name == 'HoverBrick' then
script.Parent.Visible = true
script.Parent.Position = UDim2.new(0, ((mouse.X)-90), 0, ((mouse.Y)-20))

else script.Parent.Visible = false

end
end
end)

function Click(mouse)
if mouse.Target ~= script.Parent.Parent then -- Script.Parent.Parent should be in either the character, or the starterpack! LocalScripts don't function outside of the player or it's character.
return -- Stops the script since they didn't click on the part that has the clickdetector
end
if script.Parent.Visible = true
then print("CLICKED!")
wait(1)
end
end

mouse.Button1Down:connect(Click) -- Old click function was deprecated.
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 02:09 PM
ohhh you need a click detector in the part?

Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 02:13 PM
The clickdetector has the function but it is deprecated. Use my code and read the comments. (deprecated means outdated and no longer used.)
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 02:15 PM
thanks dude i finally got it to work aha im new at this so a lot of this doesnt make sense
especially local scripts

Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
03 Jan 2016 02:18 PM
Players.Player.PlayerGui.Hover.Frame.LocalScript:17: attempt to index local 'mouse' (a nil value)



Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
03 Jan 2016 02:20 PM
mouse = player:GetMouse()
Report Abuse
crazycittykat is not online. crazycittykat
Joined: 22 Dec 2012
Total Posts: 195
03 Jan 2016 02:25 PM
no problem!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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