edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 07:54 AM |
I have added the following function to my script. Its meant to move the camera back to the players body (From a menu camera), however, despite it working in offline mode, online mode creates a second outcome where this doesnt work. I have no idea what to do.
function Activate() if game.Players.LocalPlayer:findFirstChild("Playing").Value == true then camera.CameraSubject = oldCameraSubject camera.CameraType = oldCameraType camera.CoordinateFrame = oldCameraCFrame camera.Focus = oldCameraFocus local d = script.LocalScript:clone() d.Disabled = false d.Parent = game.Players.LocalPlayer.Character local k = script.Intro:clone() k.Disabled = false k.Parent = game.Players.LocalPlayer.PlayerGui end end
game.Players.LocalPlayer.Playing.Changed:connect(Activate) |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 08:30 AM |
| Any help? Do I need to post the rest of the script? |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 08:44 AM |
| Its a bool value added into the player, along side that, this script is added into the player as well. However, befroe jumping to the conclusion that the playing value doesnt exist in time, the playing value is added before this script. |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 09:15 AM |
| This is an altered script of HotToth's cutscene script. It is only the ending that is altered. I can upload the script in its entirity if you'd like. |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 10:02 AM |
local camTrack = game.Workspace.MenuTrack
-- accel (recommended values between .01 and 1) determines how much "ease" there is; higher numbers means it goes more straight from one frame to the next local accel = .05
-- ***** Don't change variables below this line ***** --
local camFrames = camTrack:GetChildren() local r = game:GetService("RunService")
function frameTime(frame) return tonumber(frame.Name) end
-- extract our camera track info [table.sort is just too cool!] table.sort(camFrames, function (a, b) return frameTime(a) < frameTime(b) end)
local camRolls = {} for i = 1, #camFrames do local newRoll = 0 if camFrames[i]:FindFirstChild("Roll") then newRoll = camFrames[i].Roll.Value end table.insert(camRolls, newRoll) end
-- make frames invisible (if they weren't already) for i = 1, #camFrames do camFrames[i].Transparency = 1 end
-- set up the initial camera configuration and store the old one local LookFrame = camFrames[1].CFrame + camFrames[1].CFrame.lookVector * 20 local camera = game.Workspace.CurrentCamera
local oldCameraType = camera.CameraType local oldCameraSubject = camera.CameraSubject local oldCameraFocus = camera.Focus local oldCameraCFrame = camera.CoordinateFrame
camera.CameraType = "Scriptable" camera.CoordinateFrame = CFrame.new(camFrames[1].CFrame.p, LookFrame.p) camera:SetRoll(camRolls[1])
-- set up movement system local keepMovementThreadAlive = true local camVelocity = Vector3.new(0, 0, 0) local camPartVelocity = Vector3.new(0, 0, 0) local camRollVelocity = 0
local camPartTargetVelocity = Vector3.new(0,0,0) local camTargetVelocity = Vector3.new(0, 0, 0)
function movementThread () local lastTime = r.Stepped:wait() while keepMovementThreadAlive do local newTime = r.Stepped:wait() local deltaT = newTime - lastTime camVelocity = camVelocity * (1 - accel) + camTargetVelocity * accel camPartVelocity = camPartVelocity * (1 - accel) + camPartTargetVelocity * accel
lastTime = newTime LookFrame = LookFrame + deltaT * camPartVelocity camera.CoordinateFrame = CFrame.new( (camera.CoordinateFrame + deltaT * camVelocity).p, LookFrame.p) camera:SetRoll(camera:GetRoll() + deltaT * camRollVelocity) end end
function toSingleCircle(angle) while angle > math.pi do angle = angle - math.pi*2 end while angle < -math.pi do angle = angle + math.pi*2 end return angle end
local movementSystem = coroutine.create(movementThread) coroutine.resume(movementSystem)
-- go through our camTrack now for i = 1, #camFrames-1 do local dT = frameTime(camFrames[i+1]) - frameTime(camFrames[i]) camTargetVelocity = (camFrames[i+1].Position - camera.CoordinateFrame.p) / dT camPartTargetVelocity = ((camFrames[i+1].CFrame.p + camFrames[i+1].CFrame.lookVector * 20) - (camera.CoordinateFrame.p + camera.CoordinateFrame.lookVector * 20)) / dT camRollVelocity = (camRolls[i+1] - toSingleCircle(camRolls[i])) / dT camera:SetRoll(toSingleCircle(camRolls[i])) wait(dT) end
-- stop movement when done keepMovementThreadAlive = false
-- ***** Cutscene Over Function ***** -- -- Default end behavior: wait for 3 seconds, then return camera to what it was before -- Edit the lines below to change what happens AFTER your cutscene ends! function Activate() if game.Players.LocalPlayer:findFirstChild("Playing").Value == true then camera.CameraSubject = oldCameraSubject camera.CameraType = oldCameraType camera.CoordinateFrame = oldCameraCFrame camera.Focus = oldCameraFocus local d = script.LocalScript:clone() d.Disabled = false d.Parent = game.Players.LocalPlayer.Character local k = script.Intro:clone() k.Disabled = false k.Parent = game.Players.LocalPlayer.PlayerGui end end
game.Players.LocalPlayer.Playing.Changed:connect(Activate)
-- ***** End of cutscene over function ***** -- Didnt put this on :P sorry |
|
|
| Report Abuse |
|
|
| |
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
| |
|
| |
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
|
| 30 May 2012 10:08 AM |
| Nope. It works offline, but not on online :/ |
|
|
| Report Abuse |
|
|
CoreHard
|
  |
| Joined: 08 Apr 2012 |
| Total Posts: 109 |
|
|
| 30 May 2012 10:08 AM |
("Playng")
Thats your mistake. Unless its a direct child. |
|
|
| Report Abuse |
|
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
| |
|
edenojack
|
  |
| Joined: 18 Jul 2008 |
| Total Posts: 989 |
|
| |
|
|
| 27 May 2014 09:29 PM |
| LocalScript/ROBLOXBROKEIT (Blame John Anyways) |
|
|
| Report Abuse |
|
|
| |
|