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

How would I be able to make a wingview?

Asked by 6 years ago

Hi there,

I am struggling on how to make a wing view camera for an airplane. What would happen is when somebody sits down in the seat, a screen Gui would be available on screen and once selected, the view would change the a view of the aircraft's wing. I don't have a clue how to do it or even start it so as much help as possible would be appreciated.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

First off, the cameras position can not be changed when the player first joins, so we need to check for when the humanoid sits, and when it does, we need to change the camera type to scriptable, allowing us to change the camera's position. The way we would do this is by connecting the changed event to the humanoid and seeing if its sitting.

game.Players.PlayerAdded:Connect(function(plr) --When a player joins
    plr.CharacterAdded:Connect(function(char) --When their character loads
        char.Humanoid.Changed:Connect(function() --when a value in the humanoid changes
            if char.Humanoid.Sit == true then --if the player is sitting
                --have your GUI in server storage named CameraGui for the next step
                local CameraGui = game.ServerStorage.CameraGui:Clone() --cloning gui
                CameraGui.Parent = plr.PlayerGui --putting gui on player's screen
                CameraGui.Name = "CameraGui" --Naming gui "CameraGui" for later
                workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
                --The above line changes the camera type to scriptable.
            elseif char.Humanoid.Sit == false then --if player isn't sitting
                if  plr.PlayerGui:FindFirstChild("CameraGui") then --if CameraGui is found
                    plr.PlayerGui.CameraGui:Destroy() --then destroy it                         
                                      workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
                    --The above line changes the camera back to custom.
                end
            end
        end)
    end)
end)

Ok, so now we have the GUI pop up when the player sits and dissapear when they stop sitting, but how do we actually change the camera's position, well first off, you will need a part somewhere in your plane called whatever you want, but in the next script, I will call it reference. Put a script in a text button inside the gui we cloned and put this in:

script.Parent.MouseButton1Click:Connect(function()
    workspace.CurrentCamera.CFrame = workspace.modelNameHere.Reference.CFrame
end)

Thats all there is to it. Hope I helped.

-Cmgtotalyawesome

Ad

Answer this question