Client side proximity prompt?

I am trying to make a loading system with a proximity prompt so then other players will not see it loaded or unloaded but I need it to be client-side, is there a way to make it work client-side?

Here is what I was trying to experiment with (Keep in mind this is in a local script)

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
	game.ServerStorage.Areatest1:Clone().Parent = workspace
	game.Workspace.Areatest2:Destroy()
end)

is there a way to make it work client-side?
(Keep in mind this is in a local script)

Based on what you just said, you are already doing it client-side.

anytime I test it, it will not work

You can’t access to ServerStorage from a local script. If you want to do it this way you will need to store the items you want to clone in ReplicatedStorage.

1 Like
local replicatedStorage = game:GetService("ReplicatedStorage")
local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function(player)
	replicatedStorage.Areatest1:Clone().Parent = workspace
	game.Workspace.Areatest2:Destroy()
end)

As mentioned, you can’t get access to the ServerStorage from a local script. Place your model into ReplicatedStorage and try this code.

dose does not seem to be working, nothing is coming up in the output

Another option could be creating a server script and firing a RemoteEvent to the client instead.

Also, where is your local script? LocalScripts don’t run inside parts/workspace. Put it in StarterPlayerScripts.

The local script is inside the proximity prompt which is inside a part

Put the script into StarterPlayerScripts, local scripts cannot run in the workspace.

Why does it have to be client-sided? It seems you want to access ServerStorage, so it should be on the server.

I am trying to make a loading system that would be client sided so then other people do not experience issues

how would i make the proximity prompt work then? I am trying to make it to when you use the proximity prompt it clones an object from replicatedstorage into workspace and deletes another object in workspace and have it client-sided so then other players do not see if its loaded or unloaded

Just make a localscript in StarterPlayerScripts then define the proximity prompt with a path to it.

proximityPrompt = game.Workspace.PathTo.ProximityPrompt
proximityPrompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.Areatest1:Clone().Parent = game.Workspace
	game.Workspace.Areatest2:Destroy()
end)

ProximityPrompt.Triggered still works in localscripts, the only difference is it only triggers for one person, the person who triggered it.

2 Likes

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