How would one go about detecting when one player clicks another player? For example if I wanted the person being clicked to die and sent back to the lobby spawn.
You need 2 scripts in startercharacterscripts and 1 remote event in replicated storage with name "clickevent" First local script:
local mouse = game.players.localplayer:GetMouse() mouse.Button1Down:Connect(Function() game.ReplicatedStorage.clickevent:FireServer(mouse.Target) end
Second server (global) script:
game.ReplicatedStorage.clickevent.onServerEvent:Connect(function(player, target) --Script Here end
target = mouse target (Model or Part Value) player = player who clicked (Player Value)
This is what you would want to do. I never tried it but ITS OK I TRY MY HARDEST. First make a rig with rig creator second name it "StarterCharacter" then put it in game.StarterPlayer. BUT DONT DO STEP 3 YET Step 2A: Make a click detector inside the UpperTorso (or torso in r6). THEN do step 3. This is the tricky part but i can manage. THE CODE!
function onClicked() local Player = script.Parent.Parent Player.Humanoid.Health = 0 script.Parent.ClickDetector.MouseClick:connect(onClicked)
also PLUS, I dont know how to make it your own character. KIDDING! Just use th- ok nevermind. it might get to confusing for now. Your welcome fellow scripter!