Player Collisions

Player Collisions





Add Script to Players

Add to ServerScriptService

local storage = game:GetService("ServerStorage")


local function onPlayerJoin(player)

    local playerModel = game.Workspace:WaitForChild(player.Name)
    for num, child in pairs(playerModel:GetChildren()) do
        if child:IsA('Part') or child:IsA('MeshPart') then
            local scriptFile = storage["Script"]:clone() 
            scriptFile.Parent = child
        end
    end
end
 

game.Players.PlayerAdded:Connect(onPlayerJoin)

Destroy Other Player

Add to ServerStorage

local part = script.Parent

local function tag(otherPart)
    if otherPart.Name == "HumanoidRootPart" then
        otherPart.Parent:Destroy()
    end
end

part.Touched:Connect(tag)

Slowly Lose Health

Add to ServerStorage

local part = script.Parent

local function tag(otherPart)
    if otherPart.Name == "HumanoidRootPart" then
        local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
        if humanoid then
            humanoid.Health = humanoid.Health - 1
        end
    end
end

part.Touched:Connect(tag)

Animate other Player

Add RemoteEvent to ReplicatedStorage

LocalScript under StarterPlayerScripts

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
local Players = game:GetService("Players")
local character = Players.LocalPlayer.Character
if not character then
    character = Players.LocalPlayer.CharacterAdded:Wait()
end
 
local humanoid = character:WaitForChild("Humanoid")
 
local myAnimation = Instance.new("Animation")

myAnimation.AnimationId = "rbxassetid://04822814884"
 
local myAnimationTrack = humanoid:LoadAnimation(myAnimation)

local function animate()
  myAnimationTrack.Priority = Enum.AnimationPriority.Idle
 if not myAnimationTrack.IsPlaying then
     myAnimationTrack:Play()
 end
end
 
remoteEvent.OnClientEvent:Connect(animate)

Script under ServerStorage (Rename to Animate)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
 
local part = script.Parent
 
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
 
local function tag(otherPart)
  if otherPart.Name == "HumanoidRootPart" then
  local name = otherPart.Parent.Name
  if otherPart.Parent.Tag then
   local player = game.Players:FindFirstChild(name)
   remoteEvent:FireClient(player)
  end
 end
end

part.Touched:Connect(tag)

Script under ServerScriptService

local storage = game:GetService("ServerStorage")


local function onPlayerJoin(player)

    local playerModel = game.Workspace:WaitForChild(player.Name)
    for num, child in pairs(playerModel:GetChildren()) do
        if child:IsA('Part') or child:IsA('MeshPart') then
            local scriptFile = storage["Animate"]:clone() 
            scriptFile.Parent = child
        end
    end
end
 

game.Players.PlayerAdded:Connect(onPlayerJoin)

Giving Player Tag Value

local part = script.Parent

local function tagger(otherPart)
  local isTagger = Instance.new('BoolValue')
 isTagger.Parent = otherPart.Parent
 isTagger.Name = 'Tag'
 isTagger.Value = true
 part:Destroy()
end

part.Touched:Connect(tagger)