So I can't make this work, and I keep getting an error. Does "CFrame.new()" even work in a local script?
code [local script]:
local Tool = script.Parent.Parent local debounce = false local fireRate = 0.2 local distance = 30 Tool.Equipped:Connect(function(Mouse) if not debounce then debounce = true Mouse.Button1Down:Connect(function() local brick = Instance.new('Part', workspace) brick.Size = Vector3.new(0.75, 0.75, 0.75) brick.CFrame = script.Parent.CFrame repeat brick.Anchored = true brick.CFrame = brick.CFrame + Vector3.new(0, 0, 3) wait(0.05) until((brick.Position - script.Parent.Position).magnitude >= distance) brick.Anchored = false end) wait(fireRate) debounce = false end end)
If this also happens to you let me know and if you figured out how to fix it also let me know. Thanks, bye! :P
Here is your fixed script.
local Tool = script.Parent.Parent local debounce = false local fireRate = 0.2 local distance = 30 Tool.Equipped:Connect(function(Mouse) if not debounce then debounce = true Mouse.Button1Down:Connect(function() local brick = Instance.new('Part', workspace) brick.Size = Vector3.new(0.75, 0.75, 0.75) brick.CFrame = script.Parent.CFrame repeat brick.Anchored = true brick.CFrame = brick.CFrame + CFrame.new(0, 0, -3) wait(0.05) until((brick.Position - script.Parent.Position).magnitude >= distance) brick.Anchored = false end) wait(fireRate) debounce = false end end)
Closed as Non-Descriptive by Lakodex and JesseSong
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?