I Would like help about server sided script

Hello I am a starter developer working on a game and I am trying to make a dialogue where when a player interacts on the proximity prompt named “Talk” it triggers a serverscriptservice script so I am trying to make it where when it triggered it the proximityprompt will disable for the player who triggered it but for the others who didn’t will still be enabled, so heres the script on server script service:

Information might be needed:

  • ProximityPrompt is on a Rig’s Torso in workspace folders
local RS = game:GetService("ReplicatedStorage")
local PPS = game:GetService("ProximityPromptService")


PPS.PromptTriggered:Connect(function(prompt, plr)
if prompt.Name == "Talk" then
	local HRP = plr.Character:FindFirstChild("HumanoidRootPart")
	local Chat = RS.NPCDialogue.Martin.MartinChat:Clone()
	local Talk = prompt:FindFirstChild("Talk 1")

    prompt.Enabled = false
	Chat.Parent = plr.PlayerGui
	Chat.MainFrame.Chat.Script.Enabled = true
	Talk:Play()
	HRP.Anchored = true
	wait(1.65)
	Chat.MainFrame.Button1.Visible = true
  end
end)

it’s a serverscript so everything that happens will always replicate onto the server and onto the clients. you might want to turn this into a localscript if you want only the player who prompted to “talk”, or fire a remote event on the client to disable the prompt

1 Like

so make the script in server script service into a local script?

if you wish to only make the prompt disabled for specific player ONLY then fire a remoteserver on the client and disable it there

1 Like

alright ima try it real quick, Thanks

Thank you very much it worked!

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