I need help once more! LocalScripts and Prox Prompts

Yes. I am aware ProximityPrompts are not s upported in local scripts, ubt I need a local-script only script to work when a prox prompt is triggered. Help, please?

workspace.Chal3.Chaal3.Chale3.ProximityPrompt.Triggered:Connect(function(player)
			game.Players.LocalPlayer.PlayerGui.LadderChallenge.LADDERTIMER.GRAAMRDER.Enabled = false
	game.Workspace.Passed:Play()
	local status = 0

	local camera = workspace.CurrentCamera
	
	local rs = game:GetService("RunService")

	local angle = 0

	local rate = 180 / 2 -- 180 degrees in 2 seconds

	rs.RenderStepped:Connect(function()
		camera.CFrame = CFrame.lookAt(camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector) * CFrame.Angles(0, 0, math.rad(angle))
	end)

	if (status == 0) then
		status = 2
		while (angle < 180) do
			local t = rs.RenderStepped:Wait()
			angle = angle + rate * t
		end
		angle = 180
		status = 1
	elseif (status == 1) then
		status = 2
		while (angle > 0) do
			local t = rs.RenderStepped:Wait()
			angle = angle - rate * t

		end
		angle = 0
		status = 0
	end



	game.Players.LocalPlayer.PlayerGui.LadderChallenge:Destroy()
	game.Workspace.ChallengeIII:Destroy()
		end)

Just script it on a normal script with the Script.RunContext = Enum.RunContext.Client

1 Like

Oh yeaaah. Thanks!

1 Like


Why is this errored?

2 Likes

Uhh… ProximityPrompt.Triggered work on a local script, it just depends on where the local script is and how you code it.

2 Likes

The LocalScript is in StarterGui, andn it doesn’t work. Code is mentioned above.

2 Likes

Becaus ethe Proximity prompt is not located where you say it is, try placing the script under the proximity Prompt (Script.Parent = ProximityPrompt) and just use script.Parent.Trigrered (The event is not write correctly since I normally press TAB)

1 Like

Try parenting it on the script or using the method Instance:WaitForChild()

1 Like

It probably don’t work because you didn’t created any variables, and didn’t check if your object are found… that’s also why you got this error.

1 Like

workspace.Chal3.Chaal3.Chale3 is a proximity prompt, you don’t need to do workspace.Chal3.Chaal3.Chale3.ProximityPrompt.

That’s why the error says “ProximityPrompt is not a valid member of ProximityPrompt”, you’re checking if you can find a proximity prompt in your proximity prompt.

workspace.Chal3.Chaal3.Chale3.Triggered:Connect(function(player)
1 Like

Yes but since is a local script it needs to use Instance:WaitForChild()

1 Like

Found that out just now. I’m going to test if it works.

1 Like

Can you try this into a local script in StarterPlayerScript ?

local Model = workspace:WaitForChild("Chal3", 30)
local ProximityPrompt = Model and Model:FindFirstChildWhichIsA("ProximityPrompt", true)

if ProximityPrompt then
	ProximityPrompt.Triggered:Connect(function(player)
		print("Triggered:", player.Name)
	end)
end
1 Like

No need, what Kydude gave me works perfectly. Thanks guys!

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