Im 100% sure i have messed it up it doesnt place anything what im trying to do is making it place a model where my mouse is but it doesnt work
local mouse = game.Players.LocalPlayer:GetMouse() local off = false local plr = game.Players.LocalPlayer local eq = false script.Parent.Equipped:Connect(function() if mouse ~= nil then eq = true local clonnedbrick = game.ReplicatedStorage.Brick:Clone() mouse.TargetFilter = clonnedbrick clonnedbrick.Transparency = .5 clonnedbrick.Parent = workspace clonnedbrick:GetPrimaryPartCFrame(clonnedbrick:SetPrimaryPartCFrame(mouse)) while mouse ~= nil do clonnedbrick.Position = mouse.Hit.p + Vector3.new(0,2,0) wait() if off then clonnedbrick:Destroy() off = false break end end end end) script.Parent.Activated:Connect(function() local pos = mouse.Hit.p + Vector3.new(0,2,0) script.Parent.RemoteEvent:FireServer(plr,pos) end) script.Parent.Unequipped:Connect(function() eq = false off = true end)
Ok there is a lot wrong here but luckily I've done nearly the same thing so just add my discord and I will get back to you tonight and I can figure out this problem for you. What I did just to get a idea was put a local script in starterplayerscripts and then whenever I clicked it would fire server to a server script then the server script would spawn a part in wherever I clicked and doing it with a model from rep storage may be a little dif but i should be able to do it my discord is bily117#5405 jus add me and ill get back to u tonight hopefully