Making a KeyCode Gravity Disabler

  1. What do you want to achieve? A working KeyCode Gravity disabler

  2. What is the issue? There are no issues in output and I do not understand what is happening

  3. What solutions have you tried so far? I have looked on youtube and on the wiki and haven’t found anything really.

This is a local script I inserted into StarterPack, and it’s not showing any errors in output

local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
debounce = false

UIS.InputBegan:Connect(function(key, processed)
    if processed or debounce then return end
    debounce = true
   
    if key.UserInputType == Enum.UserInputType.Keyboard then
	       if key.KeyCode == Enum.KeyCode.E then
		workspace.Gravity = 0
	end
end
end)

SHORT VERSION : Help me fix my KeyCode gravity disabler

2 Likes

This is being done from a local script. Setting the gravity has to be done by a server script so that it can appear to other players.

You should research into remove events. These allow you to communicate between the client (player) and server.

Okay, thank you! :grin: (30 characters)