- What do you want to achieve? creating a ProximityPrompt that only appears for a certain player if they:
- own a certain area
- are within a certain radius of that area’s designated laptop
- What is the issue? Include screenshots / videos if possible!
the script is working perfectly fine in the studio, however it does not work inside of a multiplayer testing or ingame.
prompt shows when in studio testing
example of multiple player testing, prompt does not show.
- What solutions have you tried so far? i have tried to edit this to wait for players to load in and completely rearrange how the script functions.
i believe this stems from how poorly i set up these scripts as i did not know a better way how to set them up.
some context for how the system works:
this is copy and pasted for various other doors and laptops in the same area, and are used if walking through a door that creates a stringvalue onto itself with the player’s name. if the player walks up to the laptop of that area, and their name matches up with the value of the stringvalue on the door, it will create a proximityprompt for only them to see and to interact with the laptop.
localscript located in the StarterPlayerScripts
local player = game.Players.LocalPlayer
local part = game.Workspace.Laptop1:WaitForChild("Screen")
local door = game.Workspace.Cafe1
if (player.Character.HumanoidRootPart.Position - part.Position).Magnitude <= 100 then
if door:WaitForChild("Owner").Value == player.Name then
local proximityPrompt = Instance.new("ProximityPrompt")
proximityPrompt.Parent = part
proximityPrompt.ActionText = "Use Laptop"
proximityPrompt.ObjectText = "Laptop"
proximityPrompt.RequiresLineOfSight = false
end
end
serverscript located on the door part
local door = script.Parent
local hasOwner = false
door.Touched:Connect(function(hit)
if hit.Parent and hit.Parent:IsA("Model") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and not hasOwner then
if player:FindFirstChild("hasArea").Value == false then
local owner = Instance.new("StringValue")
owner.Value = player.Name
owner.Name = "Owner"
owner.Parent = door
hasOwner = true
end
if player:FindFirstChild("hasArea").Value == false then
player.hasArea.Value = true
else
print("player has an area")
end
end
end
end)
it’s very, VERY messy and unfortunately, i do not know a way to fix this issue or clean up the script. i would greatly appreciate any help on either of these matters.