So I have a script that runs multiple times depending on how many times they have dont that,
which is not what I want, I want it to only do it once,
Btw it does it twice if the player has called the function twice, once if the called it once, etc.
So how would I fix this?
I also know that it is happening on the client, or at least I think
Client
promt2.Triggered:Connect(function()
local frame = script.Parent.PlayRecording
frame.Visible = true
frame.TextButton.Activated:Connect(function()
if frame.NameBox.ContentText ~= nil and frame.NameBox.ContentText ~= ' ' then
-- then it is a name so we can send it to the server
local event = game:GetService('ReplicatedStorage'):FindFirstChild('ViewRecording')
event:FireServer(frame.NameBox.ContentText)
frame.Visible = false
end
return
end)
end)
Server
eventRecord2.OnServerEvent:Connect(function(player,name)
-- check for recording
warn('Looking for recording')
if recordings[name] then
displayRecording(recordings[name])
else
warn('Recording not found')
end
end)
Thanks!