Is there a way I can make this dialog script only work for one team. I called the team function but cant seem to get any kind of restriction for checking the team before activating the prompt.
local say = {"test."}
local debounce = false
local sound = script.Parent.Tool.Handle.talk
local prompt = script.Parent.ProximityPrompt
local clicksound = script.Parent.Tool.Handle.click
local Teams = game:GetService("Teams")
local team = Teams["team1"]
local hasClicked = false
game.ReplicatedStorage.DetectClick.OnServerEvent:Connect(function()
hasClicked = true
end)
prompt.Triggered:Connect(function(plr)
if plr.PlayerGui.NpcChatGui.Enabled then return end
sound:Play()
plr.PlayerGui.NpcChatGui.NpcName.Text = script.Parent.Name
plr.PlayerGui.NpcChatGui.Enabled = true
for i, v in pairs(say) do
hasClicked = false
for i = 1, string.len(v) do
plr.PlayerGui.NpcChatGui.NpcText.Text = string.sub(v, 1, i)
end
while wait() do
if hasClicked then
clicksound:Play()
break
end
end
end
plr.PlayerGui.NpcChatGui.Enabled = false
end)
local say = {"Test"}
local debounce = false
local sound = script.Parent.Tool.Handle.talk
local prompt = script.Parent.ProximityPrompt
local clicksound = script.Parent.Tool.Handle.click
local Teams = game:GetService("Teams")
local team = Teams["team1"]
local hasClicked = false
game.ReplicatedStorage.DetectClick.OnServerEvent:Connect(function()
hasClicked = true
end)
prompt.Triggered:Connect(function(plr)
if plr.Team ~= team then return end
if plr.PlayerGui.NpcChatGui.Enabled then return end
sound:Play()
plr.PlayerGui.NpcChatGui.NpcName.Text = script.Parent.Name
plr.PlayerGui.NpcChatGui.Enabled = true
for i, v in pairs(say) do
hasClicked = false
for i = 1, string.len(v) do
plr.PlayerGui.NpcChatGui.NpcText.Text = string.sub(v, 1, i)
end
while wait() do
if hasClicked then
clicksound:Play()
break
end
end
end
plr.PlayerGui.NpcChatGui.Enabled = false
end)