local crateValue = game.Players.LocalPlayer:WaitForChild("stats").CrateValue
local event = game.ReplicatedStorage.ChangeCrate
local cameras = workspace:WaitForChild('Cameras')
local camera1 = cameras:WaitForChild('Camera1')
local camera2 = cameras:WaitForChild('Camera2')
local camera3 = cameras:WaitForChild('Camera3')
local camera4 = cameras:WaitForChild('Camera4')
local camera5 = cameras:WaitForChild('Camera5')
local camera6 = cameras:WaitForChild('Camera6')
local camera7 = cameras:WaitForChild('Camera7')
local camera = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if crateValue.Value ~= "Rainbow Crate" then
if crateValue.Value == "Medium Crate" then
lerpCam(camera2,camera3)
event:FireServer(plr,"Large Crate")
else if crateValue.Value == "Large Crate" then
lerpCam(camera3,camera4)
event:FireServer(plr,"Insane Crate")
else if crateValue.Value == "Insane Crate" then
lerpCam(camera4,camera5)
event:FireServer(plr,"Bronze Crate")
else if crateValue.Value == "Bronze Crate" then
lerpCam(camera5,camera6)
event:FireServer(plr,"Silver Crate")
else if crateValue.Value == "Silver Crate" then
lerpCam(camera6,camera7)
event:FireServer(plr,"Rainbow Crate")
else if crateValue.Value == "Small Crate" then
event:FireServer(plr,"Medium Crate")
lerpCam(camera1,camera2)
else
end
end
end
end
end
end
end
end)
function lerpCam(cam1,cam2)
for Num = 0,1,0.1 do
camera.CFrame = cam1.CFrame:lerp(cam2.CFrame,Num)
wait()
end
end
Event fired here ^
game.ReplicatedStorage.ChangeCrate.OnServerEvent:Connect(function(plr,plr1,str)
local stats = plr:WaitForChild("stats").CrateValue
stats.Value = str
end)
Code activates here. It doesn't work in my game, what is wrong with it?

2 comments
I recommend doing "game.ReplicatedStorage:WaitForChild("ChangeCrate")"
ok