I have a script that blurs a players screen and forces them to stop moving when they click/touch a button then it teleports them, unblurs, and allows the player to move again, but it doesn’t unblur and allow the player to move again if they were moving as they clicked or touched the button.
No errors are shown.
This is a local script for a BillboardGUI button located in StarterGUI as I can only get it to work there.
(I attempted to fix the issue by placing parts of the script in an If statement, but it does nothing.)
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local lighting = game.Lighting
script.Parent.TextButton.MouseButton1Click:Connect(function()
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
repeat wait()
lighting.Blur.Size += 1
until lighting.Blur.Size == 56
if lighting.Blur.Size == 56 then
character:MoveTo(game.Workspace.Locations.Playground.Location.Position)
repeat wait()
lighting.Blur.Size -= 1
until lighting.Blur.Size == 6
humanoid.JumpPower = 50
humanoid.WalkSpeed = 16
end
end)
The next is a script placed in a part that when touched, does the same as the last script.
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent.Character
local humanoid = character.Humanoid
local lighting = game.Lighting
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
repeat wait()
lighting.Blur.Size = lighting.Blur.Size + 0.5
until lighting.Blur.Size == 56
character:MoveTo(game.Workspace.Locations.Hills.Location.Position)
repeat wait()
lighting.Blur.Size = lighting.Blur.Size - 1
until lighting.Blur.Size == 6
humanoid.JumpPower = 50
humanoid.WalkSpeed = 16
end)