Hello, I’m working on a game called Paper Airplane Simulator and In it the player has a tool which changes the players camera to the airplane when it gets launched, but I’m having trouble returning the camera back.
Current code (localscript:)
local Handle = script.Parent:WaitForChild("Handle")
local tool = script.Parent
local player = game.Players.LocalPlayer
local player = game:GetService("Players").LocalPlayer
local playercam = workspace.CurrentCamera
if workspace.FilteringEnabled then
tool.Activated:Connect(function()
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
tool.Bounce:FireServer(mouse.Hit.p)
playercam.CameraSubject = script.Parent.Handle.Campart
end)
end)
end
Dont know if it helps but this is the server script:
local plr
local ClonedTool = game.ReplicatedStorage.PaperAirplane:Clone()
local Player = game:GetService("Players")
local Handle = script.Parent.Handle
local PhysicsService = game:GetService("PhysicsService")
local collisionGroupPlane = "Plane"
local collisionGroupAreas = "NonCollidable"
PhysicsService:RegisterCollisionGroup(collisionGroupPlane)
PhysicsService:RegisterCollisionGroup(collisionGroupAreas)
PhysicsService:CollisionGroupSetCollidable(collisionGroupAreas, collisionGroupPlane, false)
tool.Bounce.OnServerEvent:Connect(function(player, event)
plr = player
print(player)
local mouse = player:GetMouse()
local ball = tool.Handle
tool.Parent = workspace
ball.CFrame = tool.Handle.CFrame
ball.CFrame = CFrame.new(ball.Position, event)
local BV = Instance.new("BodyVelocity", ball);
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BV.Velocity = ball.CFrame.lookVector * 50 -- how fast it throws
wait(.1)
tool.Handle.BodyVelocity:Destroy()
local Camera = workspace.Camera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = tool
end)
local isTouched=false
script.Parent.Handle.Touched:Connect(function(hit)
print("hit")
if hit.Parent:FindFirstChild("Part") then
print("Is part")
wait(2)
script.Parent:Destroy()
local ClonedTool = game.ReplicatedStorage.PaperAirplane:Clone()
ClonedTool.Parent = plr.Backpack
print("Destroyed")
plr.leaderstats.Coins.Value += 20
game.Workspace.Coins:Play()
end
end)
And this is how the tool looks like:

Any help is appreciated. Thank you!