Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script works in Studio but not the base game itself?

script.Parent.MouseButton1Down:connect(function()
bin = script.Parent

function Clicked()
bin.Parent.Visible = false 
end 
bin.MouseButton1Down:connect(Clicked)
    game.Players.LocalPlayer.CameraMaxZoomDistance = .5
end)
bin = script.Parent

function Clicked()
bin.Parent.Visible = false 
end 
bin.MouseButton1Down:connect(Clicked)
game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
    game.Players.LocalPlayer.CameraMaxZoomDistance = 20
end)

It's supposed to lock the player in first person when he clicks the "Play" button and make the menu disappear. The menu disappears, but the player is not locked in first person. Is there anything I can do to fix this script?

2 comments

0

Read this. I'm 90% the solution to your problem is in it. https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online

0

I read it. What would you recommend me to change in my script?

1 answer

✓ Accepted answer
  1. Make sure it's in the proper script, in that case try to put it in a 'LocalScript' if it is already then go to number 2.

  2. When you're In - Game try pressing F9 to open the console and you'll see the error there. if you're having problem with the "Character" then try

player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
-- scripts
--ends

1 comment

0

I put it in a local script and added the code, and it works! Thanks very much!

This discussion is preserved as it was. New answers, comments, and votes are closed.