So, How do I find the names of each player in the server, then place their names in the name of a different brick each?
Yup, pretty confusing, for example, there are two players on the server, bob and bill. I want to put 'bill' in the name of brick 1, and I also want to put 'bob' in the name of brick 2.
And both of those bricks are supposed to kill their player when they're clicked.
(The killing script, i just need help editing it to find the player who it's going to kill.)
function onClicked(playerWhoTouched) workspace.IAmSoloz.Humanoid.Health = 0 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
First, you'd need to get the names first. Depending if you have filtering enabled on, it could be different, but I'll just say it the filtering enabled way.
You'll need a local script, and a server script.
Here's the script, and I'll comment along the way on what each part means.
local debouce = false local rEvent = Instance.new("RemoteEvent", game.ReplicatedStorage) -- To communicate between server and client. rEvent.Name = "rEvent" game.Players.PlayerAdded:connect(function(plr) if not debounce then debounce = true local brick = Instance.new("Part", game.Workspace) local clickDetect = Instance.new("ClickDetector", brick) brick.Name = plr.Name -- Making the brick, so then the client can find it. rEvent:FireClient(plr) -- Fire the client of the player with remote event for communicating if the brick got clicked or not. debouce = false end end)
Then for the local script, you're just going to have something like
local plr = game.Players.LocalPlayer local char = plr.Character game.ReplicatedStorage.rEvent.OnClientEvent:connect(function() game.Workspace:findFirstChild(plr.Name).ClickDetector:MouseButton1Click:connect(function() char.Humanoid:TakeDamage(100) end) end)
Keep in mind I'm a beginner as well, so this very well could not work. You've been warned.
Hope this works anyways, and good luck!