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: Stupid error?

Previous Thread :: Next Thread 
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
13 Mar 2015 02:33 PM
Mouse.KeyDown:connect(function(Key)
if Key == "f" then
print("Worked")
game.Workspace.Part.BillboardGui.Frame.TextLabel.Text = "Planted"
end
end)


Doesnt work
Report Abuse
gerov is not online. gerov
Joined: 05 Feb 2011
Total Posts: 5504
13 Mar 2015 02:35 PM
Is it in a localscript?

Dolph Lundgren of OT.
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
13 Mar 2015 02:36 PM
ew KeyDown


CentOS-Web = /var/www/html/
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
13 Mar 2015 02:37 PM
yes ofc

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

while wait(0.1) do
if Mouse.Target == workspace.Part then
workspace.Part.BillboardGui.Frame.Visible = true
else if Mouse.Target ~= workspace.Part then
workspace.Part.BillboardGui.Frame.Visible = false
end
end
end

Mouse.KeyDown:connect(function(Key)
if Key == "f" then
print("Worked")
game.Workspace.Part.BillboardGui.Frame.TextLabel.Text = "Planted"
end
end)
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
13 Mar 2015 02:44 PM
b
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
13 Mar 2015 02:56 PM
Is your caps lock on
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
13 Mar 2015 02:58 PM
Oh, your script won't get past the while loop. It's repeating the lines infinitely.

You can use a coroutine or simply place the while loop at the end. I recommend coroutine.

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

coroutine.wrap(function()
while wait(0.1) do
if Mouse.Target == workspace.Part then
workspace.Part.BillboardGui.Frame.Visible = true
else if Mouse.Target ~= workspace.Part then
workspace.Part.BillboardGui.Frame.Visible = false
end
end
end
end)()

Mouse.KeyDown:connect(function(Key)
if Key == "f" then
print("Worked")
game.Workspace.Part.BillboardGui.Frame.TextLabel.Text = "Planted"
end
end)
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
13 Mar 2015 03:00 PM
@iiEssence, He could also just move the event above the while loop.
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
13 Mar 2015 03:02 PM
"You can use a coroutine or simply place the while loop at the end."
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
13 Mar 2015 03:03 PM
Oops, didn't read that part. Sorry xD
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
13 Mar 2015 03:52 PM
is the localscript in workspace
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