My script only runs once when I click the proximity and once I exit out of the gui, i cant click e to open it again.
game.StarterGui.Dialog.DialogFrame.Visible = false
local textchat = script.Parent.Text.Value
local function typetext(player)
local text = script.Parent.Text.Value
for i = 1, #text do
player.PlayerGui.Dialog.DialogFrame.NPCChat.Text = string.sub (text, 1, i)
wait(0.05)
end
end
local ProximityPromptService = game:GetService("ProximityPromptService")
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
print("Triggered")
--player.PlayerGui.Dialog.DialogFrame.NPCChat.Text = textchat
player.PlayerGui.Dialog.DialogFrame.Visible = true
typetext(player)
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)
When you change something on the server side (this script) it will show for all clients. For example, when you change the Visible property of the DialogFrame, as you did in this script, it will show for the client. BUT, when you override this on the client, it will no longer allow the server to make changes. Since you overrided a server-wide change, it will no longer copy the server, and do it’s own thing.
You should make this client-sided instead, and for each client make sure that the player triggering the ProximityPrompt is the LocalPlayer.
Apologies if this was hard to understand. Let me know if you need any more help.