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: :GetMouse() returning nil

Previous Thread :: Next Thread 
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:33 PM
wait(0.5)

p = game.ServerStorage.Table


function onClicked()
Player = game.Workspace:FindFirstChild(script.Parent.Parent.Name)
mouse = game.Players:FindFirstChild(Player.Name):GetMouse()

p3 = game.Workspace:WaitForChild(Player.Name.."'sTable")
p3:clone()
p3.Parent = game.Workspace
script.Parent:remove()
end

function onEquipped()
Player = game.Workspace:FindFirstChild(script.Parent.Parent.Name)
mouse = game.Players:FindFirstChild(Player.Name):GetMouse()

while script.Parent.Parent.Name == Player.Name do
p2 = p:clone()
p2.Name = Player.Name.."'sTable"
p2.Parent = game.Workspace
p2.Position = Vector3.new(math.floor(mouse.Hit.X), math.floor(mouse.Hit.Y), math.floor(mouse.Hit.Z))
wait(0.1)
p2:remove()
end
end

script.Parent.Activated:connect(onClicked)
script.Parent.Equipped:connect(onEquipped)


So this is my version of a placable block. :D That is updating wherever the mouse is pointing.. (Kinda like an insert tool) Sad thing is, it works perfectly fine in solo, but in an actual server, it doesn't.. Just gives the error:

"Players.computerchris.Backpack.Crafting Table.Player:24: attempt to index global 'mouse' (a nil value)"

Please help?
Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
22 Jul 2014 04:35 PM
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()


Make sure it's a local script.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2014 04:37 PM
wait(0.5)

p = game.ServerStorage.TabIe

function onClicked()
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()

p3 = game.Workspace:WaitForChild(Player.Name.."'sTable")
p3:cIone()
p3.Parent = game.Workspace
script.Parent:remove()
end

function onEquipped()
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()

whiIe script.Parent.Parent.Name == Player.Name and Spawn(wait) do
p2 = p:clone()
p2.Name = Player.Name.."'sTable"
p2.Parent = game.Workspace
p2.Position = Vector3.new(math.floor(mouse.Hit.X), math.floor(mouse.Hit.Y), math.floor(mouse.Hit.Z))
wait(0.1)
p2:remove()
end
end

script.Parent.Activated:connect(onClicked)
script.Parent.Equipped:connect(onEquipped)
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jul 2014 04:37 PM
p = game.ServerStorage.Table

^It wouldn't work in a local script either
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:39 PM
So what's wrong with it?

:/ Local script or no??
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jul 2014 04:41 PM
You can't use ServerStorage in a local script

You can't use :GetMouse() from a non local script
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:43 PM
So move my table to lighting and use local script?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:45 PM
ugh...

workspace:ClearAllChildren()
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jul 2014 04:45 PM
No move it to Rep Storage
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:45 PM
Pointless post. Please leave.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:46 PM
who me?
i just helped u
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:48 PM
How so? Posting ugh, then proceeding to give the advice of clear workspace.... How in any scripting area is that help except to remove a game?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:48 PM
wow ungrateful brat i fixed it
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:50 PM
Fixed what??
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:51 PM
ur problem!
wow giving this to every1
so ungrateful
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 04:55 PM
Please leave.. You're help is no longer required. Or appreciated. Thank you for attempting to troll.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:55 PM
tell my dad hes builderman!
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2014 04:56 PM
These guys would know
http://www.roblox.com/Forum/ShowForum.aspx?ForumID=33

theres a reason its called Scripters its because all the smartest scripters go there
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Jul 2014 04:57 PM
ya go to scripters!
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jul 2014 05:02 PM
No move it to Rep Storage[2]
Report Abuse
computerchris is not online. computerchris
Joined: 02 May 2009
Total Posts: 665
22 Jul 2014 05:48 PM
128GB thank you. Got it.. :D
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