-
What do you want to achieve? Arrow Checkpoint that lets players see an arrow every-time their is a new checkpoint ahead.
-
What is the issue? I got everything to work so far, but later I had implemented a new “Reset Stages” Gui, and when I player clicks it. It resets the players stages, and respawns them at the beginning. Only problem is that after they use the “Reset Stage” Gui, they aren’t able to see the arrows so far.
-
What solutions have you tried so far? Im guessing it has to do with this one part of the script, if anyone can help out.
Here’s the whole code - (Work’s totally fine just not after player reset’s stages)
--[[
@author TwinPlayzDev_YT
@since 6/1/2021
This script will place arrows, on checkpoints for players to see where they are heading.
--]]
-- [ SERVICES ] --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
-- [ LOCALS ] --
local arrow = ReplicatedStorage:WaitForChild'Arrow':Clone()
local sound = script.Parent:WaitForChild("Sound")
local player = Players.LocalPlayer
local stage = player:WaitForChild'leaderstats':WaitForChild'Stage'
local cps = workspace:WaitForChild'CheckPoints'
-- [ FUNCTIONS ] --
arrow.Parent = workspace
if(stage.Value+1<=15)then
arrow.CFrame = cps:WaitForChild(stage.Value+1).CFrame*CFrame.new(0,arrow.Size.Y+0.5,0)*CFrame.Angles(0,0,math.rad(180))
end
coroutine.wrap(function()
while wait() do
if(arrow)then
arrow.CFrame = arrow.CFrame*CFrame.Angles(0,math.rad(5),0)
else
break
end
end
end)()
stage:GetPropertyChangedSignal'Value':Connect(function()
sound:Play()
local newval = stage.Value
if(arrow)then
if(newval>1 and newval+1<=15)then
arrow.CFrame = cps:WaitForChild(newval+1).CFrame*CFrame.new(0,arrow.Size.Y+0.5,0)*CFrame.Angles(0,0,math.rad(180))
elseif(newval+1>15)then
arrow:Destroy()
script.Parent:Destroy()
end
end
end)
Im guessing it has to do with →
stage:GetPropertyChangedSignal'Value':Connect(function()
sound:Play()
local newval = stage.Value
if(arrow)then
if(newval>1 and newval+1<=15)then
arrow.CFrame = cps:WaitForChild(newval+1).CFrame*CFrame.new(0,arrow.Size.Y+0.5,0)*CFrame.Angles(0,0,math.rad(180))
elseif(newval+1>15)then
arrow:Destroy()
script.Parent:Destroy()
end
end
end)
Please let me know, how I can fix this.