Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the ProximityPromt become active?

im a little new to scripting but why doesn't this fire?

localscript

local proxy = script.Parent.ProximityPrompt
local event = game:GetService("ServerStorage"):WaitForChild("HasCrowbar")

if event.OnClientEvent then
	proxy.Enabled = true
end

event.OnClientEvent:Connect(oneventFired)

here's the other side of the code

script

local promt = script.Parent

local original = game:GetService("ReplicatedStorage"):WaitForChild("Crowbar")
local event = game:GetService("ServerStorage"):WaitForChild("HasCrowbar")

local spots = script.Parent.Parent.Parent

promt.TriggerEnded:Connect(function(player)
	local new = original:Clone()
	new.Parent = player.Backpack
	print("player has crowbar")
	event:FireClient(player)
	wait(0.2)
	spots:Destroy()
end)

3 answers

I cooked up a new script for you!

The problem is you can't check if the event has been fired, you have no function so the OnClientEvent will not fire which will bring you an error of no function found

If the script works, I'd appreciate it a lot if you accept my answer!

Here's your script, It must be a Local Script

local proxy = script.Parent.ProximityPrompt
local hasCrowbarRE = game:GetService("ServerStorage"):WaitForChild("HasCrowbar")

hasCrowbarRE.OnClientEvent:Connect(function()
	proxy.Enabled = true
end)

3 comments

0

the code did not work unfortunately, I've edited my post to show the other side

0

Are you trying to disable the proximity prompt?

0

im trying to enable it

You can't access ServerStorage on the client. It can only be used by server scripts. Try placing the event in ReplicatedStorage

local proxy = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage"):WaitForChild("HasCrowbar") -- Change if you want

event.OnClientEvent:Connect(function()
	proxy.Enabled = true
end)


You would also change the location reference in the Server script

local promt = script.Parent

local original = game:GetService("ReplicatedStorage"):WaitForChild("Crowbar")
local event = game:GetService("ReplicatedStorage"):WaitForChild("HasCrowbar") -- Change if you want

local spots = script.Parent.Parent.Parent

promt.TriggerEnded:Connect(function(player)
    local new = original:Clone()
    new.Parent = player.Backpack
    print("player has crowbar")
    event:FireClient(player)
    wait(0.2)
    spots:Destroy()
end)

1 comment

0

sadly didn't work, do you think perhaps reworking the local script to a server side one would be better?

hey you! have you ever heard of enes? if you are in trouble, better call enes!

This discussion is preserved as it was. New answers, comments, and votes are closed.