Im learning about FE, so i made this FE Forcefield gui, so when you click it you get a forcefield, but your WalkSpeed and JumpPower lower for 10 seconds. It works in studio, but not online, can anyone find the problem?

local script:

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Remote:FireServer("ForceField")
end)

serverscript:

debounce = false

game.ReplicatedStorage.Remote.OnServerEvent:Connect(function(player, FF)
	if debounce then return end
	debounce = true
	if FF == "ForceField" then
		local player = game.Players.LocalPlayer
		FF = Instance.new("ForceField")
		local sparkles = Instance.new("Sparkles")
		sparkles.SparkleColor = Color3.fromRGB(255, 255, 255)
		sparkles.Parent = player.Character.HumanoidRootPart
		player.Character.Humanoid.WalkSpeed = 12.5
		player.Character.Humanoid.JumpPower = 40
		FF.Parent = player.Character
		wait(10)
		FF:Remove()
		sparkles:Remove()
		player.Character.Humanoid.WalkSpeed = 16
		player.Character.Humanoid.JumpPower = 50
		debounce = false
	end
end)

I used a RemoteEvent.

5 comments

0

Put the RemoteEvent in ReplicatedFirst and use WaitForChild just in case (define it as a variable)

0

ok

0

still doesnt work

0

Just a side note, your debounce will make it so only player can get a forcefield at a time, what you have to do is store a table of players that are 'debounced' if you wanted multiple players to have a forcefield.

0

how do u do that