Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 8 years ago
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?

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 BlueTaslem 18071 — 8y
0
I read it. What would you recommend me to change in my script? MariusAurelius 85 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
  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
0
I put it in a local script and added the code, and it works! Thanks very much! MariusAurelius 85 — 8y
Ad

Answer this question