I am not sure if the remote event called "Delete" is getting called. I am using zblox's grid-placement tutorial.
Here is the Client side of the script:
--Services local runService = game:GetService("RunService") --Instances local player = game.Players.LocalPlayer local mouse = player:GetMouse() local DeleteRE = game.ReplicatedStorage.Events.Delete local obj --Bools local deleteToggle = false --Functions/Events script.Parent.MouseButton1Click:Connect(function() if deleteToggle then deleteToggle = false else deleteToggle = true end end) mouse.Button1Down:Connect(function() if obj then DeleteRE:FireServer(obj.Parent) end end) runService.RenderStepped:Connect(function() if deleteToggle then if mouse.Target then if mouse.Target == "Primary" then obj = mouse.target print(obj) end end end end)
And here is the server-side:
local DeleteRE = game.ReplicatedStorage.Events.Delete DeleteRE.OnServerEvent:Connect(function(plr, obj) if obj.Primary then local stats = plr.leaderstats local cash = stats.Cash cash = cash.Value + obj.Price.Value/2 obj:Destroy() end end)
Thanks for the help!