Proximity prompt fire remote event from local script

Local script

local proximityPrompt = script.Parent
local RS = game:GetService("ReplicatedStorage")
local SweepEvent = RS.Events:WaitForChild("Sweep")

proximityPrompt.PromptButtonHoldBegan:Connect(function(player)
SweepEvent:FireServer("Stop")
print("Began")
end)

SSS

local RS = game:GetService("ReplicatedStorage")
local SweepEvent = RS.Events:WaitForChild("Sweep")

SweepEvent.OnServerEvent:Connect(function(Player, Action)
	if Action == "Stop" then
		local character = Player:FindFirstChild("Character")
		local humanoid = character:FindFirstChild("Humanoid")
		print("Fired")
		if character and humanoid then
			humanoid.WalkSpeed = 0
			humanoid.JumpPower = 0
			humanoid.UseJumpPower = true
			humanoid.AutoJumpEnabled = false
		end
		
	end
end)

When you start holding the proximity prompt a remote event fire. It not working no errors

LocalScript do not work in the workspace, you need to put it in StarterPlayerScript.

local RS = game:GetService("ReplicatedStorage")
local SweepEvent = RS.Events:WaitForChild("Sweep")

--change it to where your proximityPrompt is in workspace
local proximityPrompt = workspace:WaitForChild("proximityPrompt")

proximityPrompt.PromptButtonHoldBegan:Connect(function(player)
SweepEvent:FireServer("Stop")
print("Began")
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.