Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Anybody see anything wrong with my god bind key script?

Asked by 5 years ago
Edited 5 years ago

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.

0
My posts are getting deleted for no reason..I just want help -_- ScriptingHelper1038 -13 — 5y
0
Didn't know I had to give credit, I do appreciate your help. ScriptingHelper1038 -13 — 5y
0
Mouse is deprecated, use the UserInputService instead, also you didnt end your functions correctly aazkao 787 — 5y
0
Try local bind. BunicornBoy 17 — 5y
View all comments (2 more)
0
Not very familiar with local's and UserInputServices just yet. But I'll try! ScriptingHelper1038 -13 — 5y
0
Oh wow I was slow and just saw the comments. I didnt know you guys said it.. mixgingengerina10 223 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
Thanks pal! I figured it would be UIS; just had problems coding with it, You're a hero! ScriptingHelper1038 -13 — 5y
0
There is so many things wrong with this code, it wont work aazkao 787 — 5y
0
I updated my answer. Too lazy to do RemoteEvents stuff mixgingengerina10 223 — 5y
0
Btw ScriptingHelper1038 You need this script in a server sided script mixgingengerina10 223 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

0
It will still work but its a good habit to use local bind instead aazkao 787 — 5y

Answer this question