【发布时间】:2021-07-03 18:41:39
【问题描述】:
有谁知道出了什么问题,脚本应该是,如果你的时间比你的时间多 750 倍,那么传送按钮变得可见并且该部分有效,但是当它到达你点击的地方时它停止工作开发控制台中没有出现错误。我认为正在发生的是事件在该行之后没有触发,因为我在之后尝试打印并且没有打印任何内容,所以我认为事件没有以某种方式触发。当您单击按钮时,文本应更改为 3 然后 2 然后 1 然后返回到原来的样子,然后您被传送到生成,如果您移动角色然后它会重置,因此文本将恢复正常并且不会传送你,你必须再次点击它并保持不动,它才能传送你。另外pog的东西是我添加到播放器中的一个布尔值,它的默认值为false,当你进入时该值就在那里。
代码位于文本按钮中的本地脚本中,该脚本位于 startergui 中的 screengui 中:
player = game.Players.LocalPlayer
character = game.Workspace[player.Name]
while true do
wait(1)
if player.leaderstats.Time.Value < player.TimeMulti.Value*750 then
script.Parent.Visible = false
elseif player.leaderstats.Time.Value >= player.TimeMulti.Value*750 then
script.Parent.Visible = true
end
end
local pog = player.pog.Value
script.Parent.MouseButton1Click:Connect(function()
pog = true
while pog == true do
wait (1)
character.Humanoid.Changed:Connect(function()
if character.Humanoid.MoveDirection.Magnitude == 0 and script.Parent.Text == "Teleport to spawn"
then
script.Parent.Text = "3"
elseif character.Humanoid.MoveDirection.Magnitude == 0 and script.Parent.Text == "3" then
script.Parent.Text = "2"
elseif character.Humanoid.MoveDirection.Magnitude == 0 and script.Parent.Text == "2" then
script.Parent.Text = "1"
elseif character.Humanoid.MoveDirection.Magnitude == 0 and script.Parent.Text == "1" then
character.Torso.CFrame = game.Workspace.Spawn.SpawnLocation.CFrame
script.Parent.Text = "Teleport to spawn"
elseif character.Humanoid.MoveDirection.Magnitude ~= 0 then
script.Parent.Text = "Teleport to spawn"
pog = false
end
end)
end
end)
【问题讨论】: