I'm making something that allows the player to jump onto a wall then be stuck to it but they can then jump off of it. Most of the script is inside of a server script doing the first part. This part is the jump off but it always works the first time I can jump back off the wall but the second time I try it the Debounce remains false. It's been confusing me all day any help?

Remote.OnClientEvent:Connect(function()
	print("Recieved from script")
	    UIP.JumpRequest:Connect(function(Space)
			if RDebounce == true then
	        RDebounce = false
		    local JAnimation = Instance.new("Animation")
		    JAnimation.AnimationId = JID
			local JAnim = Character.Humanoid:LoadAnimation(JAnimation)
         	JAnim:Play()
		        SRemote:FireServer()
		        wait(0.38999)
		        JAnim:AdjustSpeed(0)
		        LT = Character.LowerTorso.CFrame
		        JAnim:Stop()
		        Character.HumanoidRootPart.CFrame = LT
			    print("Sent to script")
			    Finished.OnClientEvent:Connect(function()
				print("Finished")
				RDebounce = true
				print("Debounce is true now")
				return
			end)
			    return
				else print("Debounce is false")
		        end
		    end)
end)

Server Script

		local R = Instance.new("PrismaticConstraint")
		print(FPlayer.Name.." is a "..FPlayer.ClassName)
		local Character = FPlayer.Character or FPlayer.CharacterAdded:wait()
		local Zero = Instance.new("Attachment")
		Zero.Parent = Character.Head
		Zero.Name = "Zero"
		local Onee = Instance.new("Attachment")
		local Animation = Instance.new("Animation")
		Animation.AnimationId = ID
		local Anim = Character.Humanoid:LoadAnimation(Animation)
	    Zero.Rotation = Vector3.new(0,-130,20) 
		Onee.Parent = W.Value
		Onee.Name = "One"
		R.Name = "Hold"
		R.LimitsEnabled = true
		R.LowerLimit = -2
		R.UpperLimit = -2
		R.Attachment0 = Zero
		R.Attachment1 = Onee
		R.Parent = W.Value
		Off = false
		local OldWs = Instance.new("NumberValue")
		OldWs.Value = Character.Humanoid.WalkSpeed
		Character.Humanoid.WalkSpeed = 0
		Anim:Play()
		Remote:FireClient(FPlayer)
		print("On wall sent to local")
		SRemote.OnServerEvent:Connect(function()
			if Debounce2 == true then
			Debounce2 = false
			print("Recieved from Script")
			Anim:Stop()
		    R:Destroy()
			H.Value = "None"
			H2.Value = "Nothing"
			W.Value = nil
			Character.Humanoid.WalkSpeed = OldWs.Value
			print("Jumped Off")
			wait(5)
			FINISHED:FireClient(FPlayer)
			Debounce = true
			Deb = true
			return
			end
		end)
	end
end)

6 comments

0

Show the bit of the code of all the RemoteEvents

0

plz show all vars otherwise its hard to help

0

As well, could you please let us know which of your prints are firing when you are attempting the second iteration of jumping? That could go a long way to helping us debug.

0

I added the server script please let me know if you need the entire scripts as these are just the parts that i figured would be most important.

0

Ignore the wait(5) in the server script I'm just trying to view the problem with it

0

NVM Solved