I have a script that clears all the children from workspace when someone presses "f". Can you help?
If you were going to ask, this IS in a local script.
local lclplr = game.Players.LocalPlayer local Mouse = lclplr:GetMouse() Mouse.KeyDown:connect(function(key) if key == "f" then game.Workspace:ClearAllChildren() end end)
There is Nothing wrong with your Script, Just that it must be in a Localscript, and placed in StarterGui or StarterPack.
if this Helped please accept answer and upvote!
If you want it to remove the children of Workspace, you probably should make it on Player entered using: game.Players.PlayerAdded:connect(function(Player) end)
And plus, I don't know if this is part of the error, but the
if Key == "f" then
should probably be if Key:lower() == "f" then
And use this in a regular script.
game.Players.PlayerAdded:connect(function(Player) Player:GetMouse().KeyDown:connect(function(Key) if Key:lower() == "f" then game.Workspace:ClearAllChildren() end end) end)