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

Why will this script only work in Solo?

This script only works in Solo Mode.

local Player = game.Players.LocalPlayer
Player.Character.Humanoid.WalkSpeed = 0
local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(Key)
if string.byte(Key) == 32 then
Player.Character.Humanoid.Health = 0
elseif string.byte(Key) == 120 then
Player.Character.Humanoid.Jump = true
elseif string.byte(Key) == 27 and Player.PlayerGui.ScreenGui.Cheat.Visible == false then
Player.PlayerGui.ScreenGui.Frame.Visible = true
Player.PlayerGui.ScreenGui.Quiter.Visible = false

end
end)

It won't work in Regular Online mode. Help!

EDIT: Whoever Thumbs down this question probably can't script. This is serious though. The whole rage game revolves around this script. It's all glitchy though. Sometimes it works, and other times it doesn't.

EDIT2: Oops, forgot to say this, This script is a LocalScript.

2 comments

0

https://scriptinghelpers.org/help/how-post-good-questions-answers Make sure you tell us what you're trying to do and also include any output, why it isn't working, what' s happening, etc.

0

I have no idea what is happening. Also there is no output. Except for the "Cutscene Editor Loading". The Cutscene editor is a plug-in.

2 answers

Someone else had a similar problem earlier:

local Player = game.Players.LocalPlayer

can only be used in a local script. This script needs to be inside a localscript in the player. (Put it in startergui or clone it into the player using :clone() )

1 comment

0

That isn't the problem. It already is in LocalScript inside of StarterGui.

A lot of times, LocalScripts will try to run before the client has actually loaded, so try adding an empty wait to the top.

wait()
local Player = game.Players.LocalPlayer
Player.Character.Humanoid.WalkSpeed = 0
local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(Key)
	if string.byte(Key) == 32 then
		Player.Character.Humanoid.Health = 0
	elseif string.byte(Key) == 120 then
		Player.Character.Humanoid.Jump = true
	elseif string.byte(Key) == 27 and Player.PlayerGui.ScreenGui.Cheat.Visible == false then
		Player.PlayerGui.ScreenGui.Frame.Visible = true
		Player.PlayerGui.ScreenGui.Quiter.Visible = false
	end
end)

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