Hi,I recently asked a question where my script didnt work for some reason,even after solution it didnt work. So when I rewrite the script I discovered the problem which is this
local ReplicatedStorage = game.ReplicatedStorage local V_tool = ReplicatedStorage.v_Tool local Tool = script.Parent Tool.Equipped:Connect(function() V_tool:Clone().Parent = workspace.CurrentCamera end)
I used even functions
local ReplicatedStorage = game.ReplicatedStorage local V_tool = ReplicatedStorage.v_Tool local Tool = script.Parent Tool.Equipped:Connect(function() CloneToCamera() end) function CloneToCamera() V_tool:Clone().Parent = workspace.CurrentCamera end
It still doesnt work so I'm confused.
So I figured it out!The problem was actually that I didn't put Handle to tool,well stupid me.
We're making a function to just get the 'Tool' object itself.
local function findTool() local V = game:GetService("ReplicatedStorage")['V_tool'] if V == nil then -- fix it; else return V; end V_tool = findTool() V_tool.Archivable = true V_tool:Clone.Parent = game.Workspace.CurrentCamera if assert(game.Workspace.CurrentCamera:FindFirstChild('V_tool') then print"cloned" else V_tool:Clone().Parent = game.Workspace.CurrentCamera end
Hello, there is a explanation for what I've done. When I looked up 'workspace' it said it had been deprecated from their servers, therefore, I use 'game.Workspace' in its stead.
Archivable is a property, inherited from Instance, that allows you to Clone something when it is true. It also allows your project to save that particular object.
I used assert() which is a function that checks if what you've put, is true or not. If it is then the if statement carries on like normal, but if it isn't then we included an else to repeat the earlier process of Cloning it.
I'm not sure what's after that...