#Digging
1 messages · Page 1 of 1 (latest)
ones that dont work
can you show the code for the scripts?
i deleted them
Ok
here is localscript
--local script
local remoteevent = script.Parent.RemoteEvent --replace this with a remote event related to the tool
script.Parent.Activated:Connect(function()
local mouse = game.Players.LocalPlayer:GetMouse()
local targetpart = mouse.Target
if targetpart and targetpart.Locked == false then
remoteevent:FireServer(targetpart)
end
end)```
and here is server script
```lua
--server script
local sound = script.Parent.Handle.Sound --replace this so it references the sound that you're trying to play
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, targetpart)
if targetpart ~= nil then
sound:Play()
targetpart:Destroy()
end
end)```
** You are now Level 1! **
where do I put these
@old bone
ok how do i do thst
do you know how to add objects like tools and scripts?
do the same thing but with a "RemoteEvent"
i have 0 scripting knowledge
** You are now Level 3! **
the explorer tree might have to look like this (pretend the blue script is a localscript)
in the tool
also this only works for unlocked parts so it doesnt work for the baseplate and for some reason players
its only supposed to remove a certain part I dont want it destroying everything
i can make it so it only removes parts with a certain name
or if the parts contain a certain name
it only takes modifying the local script
--local script
local remoteevent = script.Parent.RemoteEvent --replace this with a remote event related to the tool
local name = "DigPart" --put the name you want the script to only destroy parts with
script.Parent.Activated:Connect(function()
local mouse = game.Players.LocalPlayer:GetMouse()
local targetpart = mouse.Target
if targetpart and targetpart.Locked == false and string.match(targetpart.Name, name) then
remoteevent:FireServer(targetpart)
end
end)```
yeah like that
ok let me test
btw on the first post i think you forgot about this rule in the guidelines
oh wait
i read it wrong
i didnt post code
yeah i read it wrong
wow that acutally worked
thanks slike
is there a way to add like a 1 second cooldown
so its not spammed
yes but i have to bed
can be either
server is better to prevent exploiters from making no cooldown