Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- [Save Point] --
- -- Based on the functionality of the Save Points seen in the game Undertale.
- -- Everything in this script is written by Tsuagon (except for the parts that were converted by ttyyuu12345's model to script converter plugin).
- ----------------------------------------------------------------------------------------------------
- -- Player Stuff --
- local player = game:GetService("Players").LocalPlayer
- local char = player.Character
- local head = char.Head
- local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
- local root = char.HumanoidRootPart
- local humanoid = char.Humanoid
- local mouse = player:GetMouse()
- ----------------------------------------------------------------------------------------------------
- -- General Stuff --
- local tweenservice = game:GetService("TweenService")
- script.Parent = game:GetService("StarterPlayer").StarterPlayerScripts
- saved = false
- savepointspawned = false
- reloaded = false
- -- Visual Effects
- local savelight = Instance.new("ColorCorrectionEffect")
- savelight.TintColor = Color3.new(1, 1, 1)
- savelight.Brightness = 0
- savelight.Enabled = true
- savelight.Parent = game:GetService("Lighting")
- -- Save Point Model
- local savepointpart = Instance.new("Part") --Converted with ttyyuu12345's model to script plugin v4
- savepointpart.Name = "Save Point"
- savepointpart.Parent = workspace
- savepointpart.Rotation = Vector3.new(-180, 0, -180)
- savepointpart.Transparency = 1
- savepointpart.Size = Vector3.new(2.6960220336914062, 2.6418802738189697, 0.001)
- savepointpart.Material = Enum.Material.SmoothPlastic
- savepointpart.Anchored = true
- savepointpart.CanCollide = false
- savepointpart.Massless = true
- local savepoint1decal = Instance.new("Decal")
- savepoint1decal.Name = "SavePoint1"
- savepoint1decal.Parent = savepointpart
- savepoint1decal.Texture = "rbxassetid://9724977951"
- savepoint1decal.Transparency = 1
- savepoint1decal.Face = Enum.NormalId.Front
- local savepoint2decal = Instance.new("Decal")
- savepoint2decal.Name = "SavePoint2"
- savepoint2decal.Parent = savepointpart
- savepoint2decal.Texture = "rbxassetid://9724980695"
- savepoint2decal.Transparency = 1
- savepoint2decal.Face = Enum.NormalId.Front
- local savepointlight = Instance.new("PointLight")
- savepointlight.Parent = savepointpart
- savepointlight.Color = Color3.new(1, 1, 0)
- savepointlight.Brightness = 0
- local savepoint1decalalt = Instance.new("Decal")
- savepoint1decalalt.Name = "SavePoint1Alt"
- savepoint1decalalt.Parent = savepointpart
- savepoint1decalalt.Texture = "rbxassetid://9724977951"
- savepoint1decalalt.Transparency = 1
- savepoint1decalalt.Face = Enum.NormalId.Back
- local savepoint2decalalt = Instance.new("Decal")
- savepoint2decalalt.Name = "SavePoint2Alt"
- savepoint2decalalt.Parent = savepointpart
- savepoint2decalalt.Texture = "rbxassetid://9724980695"
- savepoint2decalalt.Transparency = 1
- savepoint2decalalt.Face = Enum.NormalId.Back
- local savepointclickdectector = Instance.new("ClickDetector")
- savepointclickdectector.Parent = savepointpart
- -- Sounds
- local savesound = Instance.new("Sound", savepointpart)
- savesound.Volume = 5
- savesound.SoundId = "rbxassetid://4613871802"
- ----------------------------------------------------------------------------------------------------
- -- Main Script --
- function save()
- local currentposition = root.CFrame
- if saved == true then return end
- if savepointspawned == true then return end
- savepointspawned = true
- savepointpart.CFrame = torso.CFrame * CFrame.new(0, 0, -5.5)
- coroutine.resume(coroutine.create(function()
- tweenservice:Create(savepoint1decal, TweenInfo.new(0.5), {Transparency = 0}):Play();
- tweenservice:Create(savepoint1decalalt, TweenInfo.new(0.5), {Transparency = 0}):Play();
- tweenservice:Create(savepointlight, TweenInfo.new(0.5), {Brightness = 11.42}):Play();
- end))
- savepointclickdectector.MouseClick:Connect(function()
- saved = true
- savepointspawned = false
- savesound:Play()
- coroutine.resume(coroutine.create(function()
- tweenservice:Create(savepoint1decal, TweenInfo.new(0.5), {Transparency = 1}):Play();
- tweenservice:Create(savepoint1decalalt, TweenInfo.new(0.5), {Transparency = 1}):Play();
- tweenservice:Create(savepointlight, TweenInfo.new(0.5), {Brightness = 0}):Play();
- end))
- end)
- repeat
- savepoint1decal.Transparency = 1
- savepoint2decal.Transparency = 0
- savepoint1decalalt.Transparency = 1
- savepoint2decalalt.Transparency = 0
- wait(0.3)
- savepoint1decal.Transparency = 0
- savepoint2decal.Transparency = 1
- savepoint2decalalt.Transparency = 1
- savepoint1decalalt.Transparency = 0
- wait(0.3)
- until saved == true
- function reload()
- if saved == false then return end
- coroutine.resume(coroutine.create(function()
- tweenservice:Create(savelight, TweenInfo.new(1.5), {TintColor = Color3.new(1, 1, 0.498039)}):Play();
- tweenservice:Create(savelight, TweenInfo.new(1.5), {Brightness = 5}):Play();
- wait(0.5)
- tweenservice:Create(savelight, TweenInfo.new(0.5), {Brightness = 0}):Play();
- tweenservice:Create(savelight, TweenInfo.new(0.5), {TintColor = Color3.new(1, 1, 1)}):Play();
- end))
- saved = false
- root.CFrame = currentposition
- end
- end
- mouse.KeyDown:Connect(function(key)
- if key == "q" and saved == false then
- save()
- elseif key == "q" and saved == true then
- reload()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement