local tool = script.Parent
local equipado = false
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local Camera = game:GetService("Workspace").CurrentCamera
local zoom = false
local cameraPos = Vector3.new(2,0,8.5)
task.wait(0.05)
print("mamauevo")
rs.RenderStepped:Connect(function()
if zoom then
print("siuuuu")
Camera.CFrame = Camera.CFrame * CFrame.new(Vector3.new(0,0,-4.5))
end
end)
tool.Equipped:Connect(function()
equipado = true
print("equipo")
end)
tool.Unequipped:Connect(function()
equipado = false
if zoom then
Camera.CFrame = Camera.CFrame * CFrame.new(Vector3.new(0,0,4.5))
zoom = false
print("desedfsdf")
end
end)
uis.InputEnded:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton2 then
if equipado then
print("termindasd")
zoom = false
end
end
end)
uis.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton2 then
if equipado then
zoom = true
print("empezo")
end
end
end)
the code is inside a tool which is in a folder in ServerStorage. when the player buys the tool it sends a remote event to the server via a local script. and then the server script clones the tool into the player’s backpack, there are other local and server scripts inside the tool that do run but that seems to be the only one that doesn’t run
I’m not an expert with having more Functions, but the problem might be that because there’s one Function, it doesn’t run the others, try using task.spawn() or coroutines, that might work
i just looked at the code the code doesnt appear to be the problem but just to make sure try printing above the variables. and if that doesnt work send a picture of your explorer tab and your properties tab while having the script selected
when the tool is in Starter Pack the script works without problems but when it is in Server Storage it gives problems after cloning itself inside the player’s backpack
Your setting the value of tool, to a folder in server storage, add a print statement before and after your first variable and see which one if either prints. Keep in mind items in ServerStorage aren’t immediately available to the client you must use a local script to clone it into the players backpack or descendants.