I have a button in my game that when a player walks over it, it plays a cut-scene. The problem is that you can keep walking over the button and it'll play again. What would I have to do to stop this? I have no scripting experience so please don't give tips! I NEED solid answers! Thanks! :)
Here's the script that's in the button:
repeat wait () until game.Workspace.CurrentCamera ~= nil
local c = game.Workspace.CurrentCamera local data = LoadLibrary("RbxUtility").DecodeJSON('[{"FOV":80,"Roll":0.05,"c1":[-27.501289367676,140.21394348145,61.993854522705,-0.39047485589981,-0.90339076519012,0.17724123597145,-0,0.19252510368824,0.98129206895828,-0.92061352729797,0.38316988945007,-0.075176224112511],"step":3.4,"f1":[-30.159908294678,125.4945602417,63.12149810791,1,0,0,0,1,0,0,0,1]},{"FOV":80,"Roll":-0.09,"c1":[-26.688184738159,102.74528503418,69.615219116211,-0.010101871564984,0.010459366254508,0.99989426136017,-7.2759584815452e-012,0.99994534254074,-0.010459898971021,-0.99994903802872,-0.00010566456330707,-0.010101317428052],"step":6,"f1":[-41.686599731445,102.90218353271,69.766738891602,1,0,0,0,1,0,0,0,1]}]')
function tweenCam(c1,f1,time,fov,roll) local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.03 for i = 1,frames do c.CameraType = "Scriptable" c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames)) c.FieldOfView = (fv0+(fov-fv0)(i(1/frames))) c:SetRoll(r0+(roll-r0)(i(1/frames))) wait() end end
print("Running")
c.CameraSubject = nil
c.CameraType = "Scriptable"
c.CoordinateFrame = CFrame.new(unpack(data[1].c1))
c.Focus = CFrame.new(unpack(data[1].f1))
c.FieldOfView = data[1].FOV
c:SetRoll(data[1].Roll)
if script:findFirstChild("SkipCutsceneGuiValue") then
local gui = script.SkipCutsceneGui:clone()
gui.Parent = game.Players.LocalPlayer.PlayerGui
gui.Cutscene.Value = script
gui.Main.Debug.Disabled = false
script.SkipCutsceneGuiValue.Value = gui
end
for i = 2,#data do
tweenCam(CFrame.new(unpack(data[i].c1)),CFrame.new(unpack(data[i].f1)),data[i].step,data[i].FOV,data[i].Roll)
end
c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
c.CameraType = "Custom"
c.FieldOfView = 70
if script:findFirstChild("SkipCutsceneGuiValue") then
if script.SkipCutsceneGuiValue.Value ~= nil then
script.SkipCutsceneGuiValue.Value:Destroy()
end
end
script:Destroy()
Maybe try a value, that saves so it knows what cut scenes the player went over, example below (Note: May not work)
cutscenes = game.workspace.cutscenes cut = game.Players.LocalPlayer.CutScene if cut.Value == 0 then -- YOUR SCRIPT HERE -- cut.Value = cut.Value +1 -- put at end else print("Cutscene already played") end
Now i wont promise it working, you'll have to create the cutscene value with another script yourself.