Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Anybody see anything wrong with my god bind key script?

It's not working.

-- Variables

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

-- Settings

bind = "r" -- has to be lowercase


-- Script

mouse.KeyDown:connect(function(key)
if key == bind then
game.Players.PlayerAdded:Connect(function(p)
	 p.CharacterAdded:Connect(function(c)
	  if p.Name == "bobplayerxd123" then
	    c.Humanoid.MaxHealth = 0
	end
	end)
	end) 

the god script was given to me.

6 comments

0

My posts are getting deleted for no reason..I just want help -_-

0

Didn't know I had to give credit, I do appreciate your help.

0

Mouse is deprecated, use the UserInputService instead, also you didnt end your functions correctly

0

Try local bind.

0

Not very familiar with local's and UserInputServices just yet. But I'll try!

0

Oh wow I was slow and just saw the comments. I didnt know you guys said it..

2 answers

✓ Accepted answer

Use UserInputService

the script -.-:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
 if input.KeyCode == Enum.KeyCode.R then
  game.Players.PlayerAdded:Connect(function(p)
     p.CharacterAdded:Connect(function(c)
      if p.Name == "bobplayerxd123" then
        c.Humanoid.MaxHealth = 0
    end
    end)
    end) 
end
UIS.InputEnded:Connect(function(input))
 if input.KeyCode == Enum.KeyCode.R then
 return 
end

4 comments

0

Thanks pal! I figured it would be UIS; just had problems coding with it, You're a hero!

0

There is so many things wrong with this code, it wont work

0

I updated my answer. Too lazy to do RemoteEvents stuff

0

Btw ScriptingHelper1038 You need this script in a server sided script

Use the UserInputService instead as mouse is deprecated. Some of your functions are not correct either, so check over them again.

Not sure if this will work but try local bind = instead of just bind.

1 comment

0

It will still work but its a good habit to use local bind instead

This discussion is preserved as it was. New answers, comments, and votes are closed.