Im confused about what went wrong. Its a workspace script.
-- GetService local proximityprompt = game:GetService("ProximityPromptService") local inputservice = game:GetService("UserInputService") local ts = game:GetService("TweenService") local ps = game:GetService("Players") -- Other Variables local player = game.Players.LocalPlayer.Character local mouse = game.Players.LocalPlayer:GetMouse() local openpc = script.Parent local typingpc = script.Parent.Parent.typingpc local holdDuration = typingpc.HoldDuration local animation1 = 'http://www.roblox.com/asset/?id=6399052845' local animation2 = 'http://www.roblox.com/asset/?id=6406983765' local anim = Instance.new("Animation") local randomNumber = math.random(5,25) local progressbar = game.StarterGui.SurfaceGui.Screen.Bar.Progress local screen = game.StarterGui.SurfaceGui.Screen randomNumber = holdDuration
game.Players.LocalPlayer cannot be used in a server script and will be nil, as there is no local player on the server. The code you've provided will only work in a local script.