Ok, so basically I was making a pretty simple eating system and I want to make it filtering enabled compatible but when it fires the event the walkspeed of the player turns to 0 instead of the value fired which is 20. Here are the scripts

Local Script inside tool

local rs = game:GetService("ReplicatedStorage")


local player = game.Players.LocalPlayer
script.Parent.Equipped:Connect(function()
	game:GetService("UserInputService").InputBegan:Connect(function(inputObject , gameProcessedEvent)
		if inputObject.KeyCode == Enum.KeyCode.R then
		local regen = 20
			rs.RemoteEvents.Eat:FireServer(regen)
			script.Parent:Destroy()
		end
	end)
end)

Server Script:

local rs = game:GetService("ReplicatedStorage")
rs.RemoteEvents.Eat.OnServerEvent:Connect(function(player, regen)
	print("dank memes")
	local playerworkspace = game.Workspace:FindFirstChild(player.Name)
	if playerworkspace:FindFirstChild("Humanoid") then
		playerworkspace.Humanoid.WalkSpeed = regen
		wait(5)
		playerworkspace.Humanoid.WalkSpeed = 16
	end
end)

I would appreciate it if you could help!

5 comments

2

just do player.Character, dont look for them in workspace

0

Yeah but the value regen is still not firing properly

1

I just tested this and it worked fine. Are you sure a separate script isn't setting the player's walkspeed?

0

just leave the regen part and just set walkspeed to 20

0

If I want different foods with different values then what will I do?