(是的,我知道这已经很陈旧了,但我对脚本编程还很陌生……)
所以我又遇到了这个问题,如果玩家2在倒计时结束后加入游戏,倒计时数字保持在15,并且玩家2的MapVotingFrame不会出现,而只发生在玩家1(类似于我的第一个问题,但颠倒了)下面是第三次的脚本:
脚本:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("IntermissonEvent")
local secondsRemaining = 15
for t = secondsRemaining, 0, -1 do
remoteEvent:FireAllClients(t)
wait(1)
endlocalscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("IntermissonEvent")
local function onTimerUpdate(seconds)
script.Parent.Text = tostring(seconds)
if seconds == 0 then
script.Parent.Parent.MapVotingFrame.Visible = true
end
end
remoteEvent.OnClientEvent:Connect(onTimerUpdate)发布于 2020-08-31 01:55:06
试着在你的问题中更清楚,我想我理解这个问题,但你仍然应该包括更多的上下文
你的主要问题是
local secondsRemaining = 15和
for t = secondsRemaining, 0, -1 do
remoteEvent:FireAllClients(t)
wait(1)
end它保持在15,因为您根本不更改secondsRemaining的值。在服务器脚本中,将其更改为;
for t = secondsRemaining, 0, -1 do
secondsRemaining = secondsRemaining - 1
remoteEvent:FireAllClients(t)
wait(1)
endhttps://stackoverflow.com/questions/63656974
复制相似问题