How do i destroy a part with this system?:
for i,v in pairs(Wood.Parent.Script:GetChildren()) do
if v:IsA('Part') then
v.Anchored = false
end
end
I have tried changing v.Anchored = false to v.Destroy
How do i destroy a part with this system?:
for i,v in pairs(Wood.Parent.Script:GetChildren()) do
if v:IsA('Part') then
v.Anchored = false
end
end
I have tried changing v.Anchored = false to v.Destroy
Its simple, use remote events
For first, create a RemoveEvent on ReplicatedStorage, now create a ServerScript(Script) in ServerScriptService and put this code:
local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") -- Event location
event.OnServerEvent:Connect(function(player,location,arg) -- you need to put the player.
if arg == "DestroyChildrenOf" then
for i,v in pairs(location:GetChildren()) do
if v:IsA("Part") then
v:Destroy() -- Changed to :Destroy
end
end
end
end)
Now on LocalScript send the location:
local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") -- Event location
event:FireServer(Wood.Parent.Script,"DestroyChildrenOf") -- Now fired server and started, (i send the location of objects to server destroy.)
Hope it helped :D
Wiki pages:
Hey, the problem i have for a long time is that i need to be able to copy it.
When you hover mouse, will show a button as "View Source", click in this button and copy and paste in your roblox studio
Hey, I would have to change the name of every remote event, that isnt possible in my case
you can change the name in script.
That i would have to do that for almost 500 of them, It would be a lot better if i could just copy the normal script over and over
why would you need 500 scripts? Either way a bad practice, I'd rethink how you do things if I were you
Okay, so i need to create a script for when i click a "tree" with a tool it needs to make the parts of it unanchord. I had it working with a Clickdetector but it would not work when holding a tool. Do you have any ideas?
The problem with this solution is that exploiters will be able to delete any part in the game.
Which is why you implement server checks, you can have a list of parts that are destroy-able
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
v:Destroy()
although it will only destroy it locally, not on the server, you would need remotes for that
Thanks!
How do i do that?