My E to Grow script isnt working

So I am trying to make a script where when the player clicks the button E on their keyboard their character grows by 1.5, for some reason when you click E nothing happens, this script was working 2 years ago when I was making this game but now it doesnt, can someone help?

local plr = game.Players.LocalPlayer

UserInputService = game:GetService("UserInputService")

local ePressed = false

UserInputService.InputBegan:Connect(function(input, gameProccosedEvent)
	if input.KeyCode == Enum.KeyCode.E then
		ePressed = true

		if ePressed then 

			plr.Character.Humanoid.HeadScale.Value = 1.5
			plr.Character.Humanoid.BodyDepthScale.Value = 1.5
			plr.Character.Humanoid.BodyHeightScale.Value = 1.5
			plr.Character.Humanoid.BodyWidthScale.Value = 1.5
			plr.Character.Humanoid.WalkSpeed = 25
			
		end
	end
end)
2 Likes

I suggest handling it to the server. Create a remote event, fire it to the server and let the server change the Character Size. Your stuff works only client sided ( only you can see the changes )

1 Like

You would need to set the properties on the server.

Other issues

= 1.5

Did you mean *= 1.5?

UserInputService = game:GetService(“UserInputService”)

Use local

ePressed = true
if ePressed then

Useless variable

gameProccosedEvent

Incorrect spelling

plr.Character.Humanoid.
plr.Character.Humanoid.
plr.Character.Humanoid.
plr.Character.Humanoid.
plr.Character.Humanoid.

Please use variables.

1 Like

The gameProcessedEvent prevents firing the function when you‘re chatting, he should implement it.

its a singleplayer game btw, does that effect any of this? also its a local script

the game is singleplayer so that doesnt matter right

Not sure about that, I recommend trying letting the server handling it.

And read what Rick said, it might fix your issue

it didnt idk why tho nothing is working

that didnt fix it idk why, my script seems to be good

I found the problem, the value of the character size is changing but not the character size

In pretty sure you should try to do it on the server? I think it’s because the server handles it that stuff, so if your doing it on the client it won’t replicate to the server

I did it on the server heres my script, for some reason when you press E you grow but when you press q you dont shrink

local remoteEvent1 = game.ReplicatedStorage.ePress
local remoteEvent2 = game.ReplicatedStorage.qPress

remoteEvent1.OnServerEvent:Connect(function(player, ePressed)
	if ePressed then 
		player.Character.Humanoid.HeadScale.Value = 1.5
		player.Character.Humanoid.BodyDepthScale.Value = 1.5
		player.Character.Humanoid.BodyHeightScale.Value = 1.5
		player.Character.Humanoid.BodyWidthScale.Value = 1.5
		player.Character.Humanoid.WalkSpeed = 25

	else
		player.Character.Humanoid.HeadScale.Value = 1
		player.Character.Humanoid.BodyDepthScale.Value = 1
		player.Character.Humanoid.BodyHeightScale.Value = 1
		player.Character.Humanoid.BodyWidthScale.Value = 1
		player.Character.Humanoid.WalkSpeed = 16

	end
end)


remoteEvent2.OnServerEvent:Connect(function(player, qPressed)
	if qPressed then 
		player.Character.Humanoid.HeadScale.Value = 0.5
		player.Character.Humanoid.BodyDepthScale.Value = 0.5
		player.Character.Humanoid.BodyHeightScale.Value = 0.5
		player.Character.Humanoid.BodyWidthScale.Value = 10.5
		player.Character.Humanoid.WalkSpeed = 18

	else
		player.Character.Humanoid.HeadScale.Value = 1
		player.Character.Humanoid.BodyDepthScale.Value = 1
		player.Character.Humanoid.BodyHeightScale.Value = 1
		player.Character.Humanoid.BodyWidthScale.Value = 1
		player.Character.Humanoid.WalkSpeed = 16

	end
end)

local UserInputService = game:GetService("UserInputService")
local remoteEvent = game.ReplicatedStorage.ePress

local ePressed = false

UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		ePressed = true
		remoteEvent:FireServer(ePressed)
	end
end)

The character size isn’t changing because you didn’t put *=, I fixed the scripts for you

--// Client //--
local UserInputService = game:GetService("UserInputService")
local remoteEvent = game.ReplicatedStorage.ePress

UserInputService.InputBegan:Connect(function(input)
	local ePressed = input.KeyCode == Enum.KeyCode.E
	if ePressed then
		remoteEvent:FireServer(ePressed)
	end
end)

--// Server //--
local RepStorage = game:GetService("ReplicatedStorage")

local remoteEvent1 = RepStorage:WaitForChild("ePress")
local remoteEvent2 = RepStorage:WaitForChild("qPress")

remoteEvent1.OnServerEvent:Connect(function(player, ePressed)
	local Humanoid = player.Character:WaitForChild("Humanoid")
	if ePressed then 
		Humanoid.HeadScale.Value *= 1.5
		Humanoid.BodyDepthScale.Value *= 1.5
		Humanoid.BodyHeightScale.Value *= 1.5
		Humanoid.BodyWidthScale.Value *= 1.5
		Humanoid.WalkSpeed = 25
	else
		Humanoid.HeadScale.Value *= 1
		Humanoid.BodyDepthScale.Value *= 1
		Humanoid.BodyHeightScale.Value *= 1
		Humanoid.BodyWidthScale.Value *= 1
		Humanoid.WalkSpeed = 16
	end
end)


remoteEvent2.OnServerEvent:Connect(function(player, qPressed)
	local Humanoid = player.Character:WaitForChild("Humanoid")
	if qPressed then 
		Humanoid.HeadScale.Value *= 0.5
		Humanoid.BodyDepthScale.Value *= 0.5
		Humanoid.BodyHeightScale.Value *= 0.5
		Humanoid.BodyWidthScale.Value *= 0.5
		Humanoid.WalkSpeed = 18
	else
		Humanoid.HeadScale.Value *= 1
		Humanoid.BodyDepthScale.Value *= 1
		Humanoid.BodyHeightScale.Value *= 1
		Humanoid.BodyWidthScale.Value *= 1
		Humanoid.WalkSpeed = 16
	end
end)
1 Like

with this script when you press E you shrink and q doe snothing

you used the code incorrectly, did you put qPress or ePress?

local RepStorage = game:GetService(“ReplicatedStorage”)

local remoteEvent1 = RepStorage:WaitForChild(“ePress”)
local remoteEvent2 = RepStorage:WaitForChild(“qPress”)

remoteEvent1.OnServerEvent:Connect(function(player, ePressed)
local Humanoid = player.Character:WaitForChild(“Humanoid”)
if ePressed then
Humanoid.HeadScale.Value *= 1.5
Humanoid.BodyDepthScale.Value *= 1.5
Humanoid.BodyHeightScale.Value *= 1.5
Humanoid.BodyWidthScale.Value *= 1.5
Humanoid.WalkSpeed = 25
else
Humanoid.HeadScale.Value *= 1
Humanoid.BodyDepthScale.Value *= 1
Humanoid.BodyHeightScale.Value *= 1
Humanoid.BodyWidthScale.Value *= 1
Humanoid.WalkSpeed = 16
end
end)

and

local RepStorage = game:GetService(“ReplicatedStorage”)
local remoteEvent2 = RepStorage:WaitForChild(“qPress”)

remoteEvent2.OnServerEvent:Connect(function(player, qPressed)
local Humanoid = player.Character:WaitForChild(“Humanoid”)
if qPressed then
Humanoid.HeadScale.Value *= 0.5
Humanoid.BodyDepthScale.Value *= 0.5
Humanoid.BodyHeightScale.Value *= 0.5
Humanoid.BodyWidthScale.Value *= 0.5
Humanoid.WalkSpeed = 18
else
Humanoid.HeadScale.Value *= 1
Humanoid.BodyDepthScale.Value *= 1
Humanoid.BodyHeightScale.Value *= 1
Humanoid.BodyWidthScale.Value *= 1
Humanoid.WalkSpeed = 16
end
end)

for q press

please put three backticks (```) for the code, like this

```lua
-- put some code here
```

and the result is:

-- put some code here
local RepStorage = game:GetService(“ReplicatedStorage”)

local remoteEvent1 = RepStorage:WaitForChild(“ePress”)
local remoteEvent2 = RepStorage:WaitForChild(“qPress”)

remoteEvent1.OnServerEvent:Connect(function(player, ePressed)
local Humanoid = player.Character:WaitForChild(“Humanoid”)
if ePressed then
Humanoid.HeadScale.Value *= 1.5
Humanoid.BodyDepthScale.Value *= 1.5
Humanoid.BodyHeightScale.Value *= 1.5
Humanoid.BodyWidthScale.Value *= 1.5
Humanoid.WalkSpeed = 25
else
Humanoid.HeadScale.Value *= 1
Humanoid.BodyDepthScale.Value *= 1
Humanoid.BodyHeightScale.Value *= 1
Humanoid.BodyWidthScale.Value *= 1
Humanoid.WalkSpeed = 16
end
end)

and for q

local RepStorage = game:GetService(“ReplicatedStorage”)
local remoteEvent2 = RepStorage:WaitForChild(“qPress”)

remoteEvent2.OnServerEvent:Connect(function(player, qPressed)
local Humanoid = player.Character:WaitForChild(“Humanoid”)
if qPressed then
Humanoid.HeadScale.Value *= 0.5
Humanoid.BodyDepthScale.Value *= 0.5
Humanoid.BodyHeightScale.Value *= 0.5
Humanoid.BodyWidthScale.Value *= 0.5
Humanoid.WalkSpeed = 18
else
Humanoid.HeadScale.Value *= 1
Humanoid.BodyDepthScale.Value *= 1
Humanoid.BodyHeightScale.Value *= 1
Humanoid.BodyWidthScale.Value *= 1
Humanoid.WalkSpeed = 16
end
end)

for q press