Change player speed using a Proximity Prompt

Sup I would like to know if it is possible to make the player’s speed change when interacting with a proximity prompt?

1 Like

yeah since it returns the player, you can just use triggerended

PROXIMITY_PROMPT_HERE.TriggerEnded:Connect(function(Player)
	local Humanoid = Player.Character and Player.Character:WaitForChild("Humanoid",3)
	
	if Humanoid then
		Humanoid.WalkSpeed += 10
	end
end)
1 Like

Cool! but where it says PROXIMITY_PROMPT_HERE am I supposed to replace it with my proximity prompt?

yes

fgegd fvrbtbtbbbrbgf

oh well this give me a issue say unknow global, any solution?

please may you paster the code you used?

Unknown Global happens when a variable isnt defined, you need to put the path to the proximity prompt

e.g

workspace.Part.ProximityPromt

ProximityPrompt.TriggerEnded:Connect(function(Player)
local Humanoid = Player.Character and Player.Character:WaitForChild(“Humanoid”,3)

if Humanoid then
	Humanoid.WalkSpeed += 10
end

end)

This is the code

if the script is inside the ProximityPrompt replace the start “ProximityPrompt” with “script.Parent”

e.g

script.Parent.TriggerEnded:Connect(function(Player)
	local Humanoid = Player.Character and Player.Character:WaitForChild("Humanoid",3)
	
	if Humanoid then
		Humanoid.WalkSpeed += 10
	end
end)
1 Like

Now it works thank you very much for helping :smiley:

1 Like