I have a tool which lets you check CCTV and stuff like that. I used a tutorial for this script:
For some reason when I equip it, it just disappears. I checked the whole game but it’s just gone from the player.
One of my tools has the exact same code, although the tablet is the only one that’s bugged
SCRIPT (Tablet):
local tool = script.Parent
local camera = game.Workspace.CurrentCamera
local tweenservice = game:GetService("TweenService")
local char = game.Players.LocalPlayer.CharacterAdded:Wait()
local equip = script.Parent:WaitForChild("EQUIP")
local unequip = script.Parent:WaitForChild("UNEQUIP")
local idle = script.Parent:WaitForChild("IDLE")
local equip_anim = char:WaitForChild("Humanoid"):LoadAnimation(equip)
local idle_anim = char:WaitForChild("Humanoid"):LoadAnimation(idle)
local unequip_anim = char:WaitForChild("Humanoid"):LoadAnimation(unequip)
local m6d
local debounce = false
tool.Equipped:Connect(function()
local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
m6d = Instance.new("Motor6D")
m6d.Parent = char:FindFirstChild("Right Arm")
m6d.Name = "RightGrip"
m6d.Part0 = a.Part0
m6d.Part1 = a.Part1
m6d.C0 = a.C0
m6d.C1 = a.C1
a:Destroy()
equip_anim:Play()
tweenservice:Create(camera, TweenInfo.new(0.5), {FieldOfView = 35}):Play()
task.wait(0.45)
idle_anim:Play()
end)
tool.Unequipped:Connect(function()
task.wait(0.35)
tweenservice:Create(camera, TweenInfo.new(0.5), {FieldOfView = 70}):Play()
idle_anim:Stop()
unequip_anim:Play()
m6d:Destroy()
end)
SCRIPT (Camera):
local tool = script.Parent
local blinker = tool:WaitForChild("Blinker")
local flash = tool.Flash.SpotLight
local flashed = false
local tweenservice = game:GetService("TweenService")
local gui = game.Players.LocalPlayer.PlayerGui.BatteryGui
local cooldown = gui.Cooldown
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local equip = script.Parent:WaitForChild("EQUIP")
local unequip = script.Parent:WaitForChild("UNEQUIP")
local idle = script.Parent:WaitForChild("IDLE")
local equip_anim = char:WaitForChild("Humanoid"):LoadAnimation(equip)
local idle_anim = char:WaitForChild("Humanoid"):LoadAnimation(idle)
local unequip_anim = char:WaitForChild("Humanoid"):LoadAnimation(unequip)
local m6d
local debounce = false
tool.Equipped:Connect(function()
local a:Weld = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
m6d = Instance.new("Motor6D")
m6d.Parent = char:FindFirstChild("Right Arm")
m6d.Name = "Handle"
m6d.Part0 = a.Part0
m6d.Part1 = a.Part1
m6d.C0 = a.C0
m6d.C1 = a.C1
a:Destroy()
gui.Enabled = true
equip_anim:Play()
task.wait(0.45)
idle_anim:Play()
end)
tool.Unequipped:Connect(function()
gui.Enabled = false
idle_anim:Stop()
unequip_anim:Play()
m6d:Destroy()
end)
VIDEO:
This only happens when I select it first. However, when I select the camera first it doesn’t get deleted, only the tablet does this.
What can I do to fix this?