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

Okay guyz this is gonna be a bit confusing but help pls ? [unanswered]

Asked by
Bulvyte 388 Moderation Voter
10 years ago

So i got my camera intro and GUI when i test it in ROBLOX Studio 2013 play solo it works but when i test it going with Play button it doesn't work heres the script and local script

Camera Script

game.Players.PlayerAdded:connect(function(player)

script.LocalScript:clone().Parent = player.CharacterAdded:wait()

end)

Camera local script

local target = workspace.IntCam.Head
local camera = workspace.CurrentCamera
camera.CameraSubject = target
local angle = 5

while wait() do 
    camera.CoordinateFrame = CFrame.new(target.Position)
                                  * CFrame.Angles(0,angle,0)
                                 * CFrame.new(0,0,-30)
angle = angle + math.rad(.3)

end

Now the first GUI script

function onButton1Down()
    game.Workspace.CurrentCamera:remove()
    wait(.1)
    game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    game.Workspace.CurrentCamera.CameraType = "Camera"
end



script.Parent.MouseButton1Down:connect(onButton1Down)

And now the last script in the GUI

script.Parent.MouseButton1Click:connect(function()
script.Parent.Visible = false
end)

So i posted my rotating camera script at the start and now the GUI's script so when i click Play button in my ROBLOX studio it works. When i test it at my profile clicking "Play" going to game then the intro rotates bla bla bla then i click Play button to skip the intro boom it doesn't work the GUI button just dissappears. Same in ROBLOX studio when running server with test and 1 player... Pls help!

P.S I can make a video if you don't understand what i mean :)

0
Do you mean the Run button with the green triangle? Because in that case, PlayerAdded and CharacterAdded will not be fired and local scripts will not work. damagex443 325 — 10y
0
No no no no When i go Play solo it works but when i go click PLAY at my profile with the green square button the game launches then the intro rotates ze camera and i click Play to skip my intro and the gui button dissappearsa and camera still keeps rotatin Bulvyte 388 — 10y

2 answers

Log in to vote
3
Answered by 10 years ago

Well I noticed to things, You remove the currentcamera, and then try to access it again once its removed. And you clone the LocalScript in an odd way?

Player.CharacterAdded:connect(function(Character)
--Cloning here
end)
0
He's cloning the LocalScript like that becuase he only wants to clone the LocalScript once when the player first spawns in. The first bit about the script in the GUI removing the CurrentCamera is correct though. Spongocardo 1991 — 10y
0
so guys i've added that player.charactedadded:connect function etc... and now it doesn't work anymore only the gui stays camera is gone Bulvyte 388 — 10y
0
so will be there an answer ? Bulvyte 388 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Alright, let's try something like this. At line 5 of your camera local script add:

game.Workspace.CurrentCamera.CameraType = "Scriptable"

Then at line 6 of that script:

-- Change:
while wait() do
-- To:
while wait() and game.Workspace.CurrentCamera.CameraType == "Scriptable" do

Now, when the CameraType changes from Scriptable to something else it will stop the loop. Then at your first GUI script remove line 2:

game.Workspace.CurrentCamera:remove()

Edit your last 2 scripts so it will look like this:

function onButton1Down()
    game.Workspace.CurrentCamera:remove()
    wait(.1)
    game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    game.Workspace.CurrentCamera.CameraType = "Camera"
end

script.Parent.MouseButton1Click:connect(function()
script.Parent.Visible = false
onButton1Down()
end)
0
No :( it doesn't work the camera stays locked doesnt rotate or anythin when i click play button to skip the intro it doesn't work too the button just dissappears... Bulvyte 388 — 10y
0
any other answers ? Bulvyte 388 — 10y
0
Put the function from your first GUI script into your last GUI script and let it run when the MouseButton1Click is fired. damagex443 325 — 10y
0
wait ? you mean cut it or just leave it ? Bulvyte 388 — 10y
View all comments (2 more)
0
I changed my answer. damagex443 325 — 10y
0
it still doesn't work.... this is so confused... Bulvyte 388 — 10y

Answer this question