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: My "Kill" Script.. Help?

Previous Thread :: Next Thread 
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 05:53 PM
Hello, ROBLOXians. Thank you very much for reading this line of text. Please, I've tried very hard to make this and it is not working. I am a Lua student, so please expect things wrong.

function onKeyDown(q)

if game.Players.Player1 == true then
game.Workspace.Player1.Humanoid:Remove()
wait(10)
game.Workspace.Player1.Head.BrickColor = BrickColor.new("Really Black")
game.Workspace.Player1.Head.Mesh:Remove()
local m = Instance.new("Message")
msg.Text = "PLAYER(Player1) was killed by *^&%#$"
wait(3)
msg:Remove()
end
end

mouse.KeyDown:connect(onKeyDown)


It says


- Workspace.Script:17: attempt to index global 'mouse' (a nil value)


It does that for everything I make.. It's very frustrating!! Thanks for the help.
Report Abuse
Roverandom is not online. Roverandom
Joined: 15 May 2011
Total Posts: 271
25 Jan 2014 05:54 PM
local script.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
25 Jan 2014 05:56 PM
Hi, I haven't played Roblox for years, but I know how to program.

Is this your whole script? On the last line you posted
mouse.KeyDown:connect(onKeyDown)
you use the variable "mouse" which hasn't been defined anywhere. Your script doesn't know what the word "mouse" means in that context
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
25 Jan 2014 05:56 PM
did you define mouse?
and don't do
if game.Players.Player1 == true tjem
do
if game.Players["Player1"] then
removing the humanoid won't kill, and you can't get a mouse without a local environment
Report Abuse
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 06:00 PM
Ooh.. Okay.. Thank you
Report Abuse
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 06:02 PM
Okay, I didn't define mouse, sorry about that. And I name dit Kill Script by accident. It is supposed to remove the humanoid, making the player just fall and not be able to do anything. Sorry about that. And I'll change the script.. Thank you! Umm.. How do you define "Mouse"?
Report Abuse
Wakarimasu is not online. Wakarimasu
Joined: 12 Nov 2013
Total Posts: 1448
25 Jan 2014 06:04 PM
mouse = whatever.You.Want
Report Abuse
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 06:07 PM
No, I mean what are you supposed to put mouse =?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
25 Jan 2014 06:08 PM
Depends on the context. Where is this script? Tool? Hopperbin? Ect
Report Abuse
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 06:11 PM
Workspace.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Jan 2014 06:12 PM
player =game.Players.Playername
Mouse = player:GetMouse()
Mouse.KeyDown:connect(function(key)
if key == "q" then
Dostuffhere
end
end)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
25 Jan 2014 06:14 PM
GetMouse() is a thing?! cool!
Report Abuse
Wakarimasu is not online. Wakarimasu
Joined: 12 Nov 2013
Total Posts: 1448
25 Jan 2014 06:15 PM
It's been here for eons.
Report Abuse
BanaynayTruck is not online. BanaynayTruck
Joined: 28 Nov 2013
Total Posts: 22
25 Jan 2014 06:17 PM
Thank you so much everyone! You really helped a lot.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
25 Jan 2014 06:19 PM
Glad to help
@the forum name :P
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