local PhysicsService = game:GetService("PhysicsService")
PhysicsService:CreateCollisionGroup("UserCollision")
PhysicsService:CollisionGroupSetCollidable("UserCollision", "UserCollision", false)
game:GetService("Players").PlayerAdded:Connect(function(Plr)
--if Plr.Name == "ElonMask0" then Plr:Kick("Stop joining ") return end
Plr.CharacterAdded:Connect(function(Chr)
--Chr.Parent = game:GetService("Workspace"):WaitForChild("Live")
local Stand = "Whitesnake" --modified later on
local StandModel = game:GetService("ServerStorage"):WaitForChild("StandModels"):WaitForChild(Stand):Clone()
StandModel.Parent = Chr
StandModel.Name = "Stand"
local Motor6D = Instance.new("Motor6D")
Motor6D.Name = "StandMotor6D"
Motor6D.Parent = Chr:WaitForChild("HumanoidRootPart")
Motor6D.Part0 = Chr.HumanoidRootPart
Motor6D.Part1 = StandModel:WaitForChild("StandHumanoidRootPart")
local BlacklistedParts = Instance.new("Folder")
BlacklistedParts.Name = "BlacklistedParts"
BlacklistedParts.Parent = StandModel
for _,v in pairs(StandModel:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") or v:IsA("Texture") then
if v:IsA("BasePart") then
v.Massless = true
v.CanCollide = false
end
if v.Transparency >0 and v.Transparency <1 then
local CustomTransparency = Instance.new("NumberValue")
CustomTransparency.Name = "CustomTransparency"
CustomTransparency.Value = v.Transparency
CustomTransparency.Parent = v
elseif v.Transparency == 1 then
local Blacklisted = Instance.new("Folder")
Blacklisted.Name = v.Name
Blacklisted.Parent = BlacklistedParts
end
v.Transparency = 1
end
end
local StandScript = game.ServerStorage:WaitForChild("StandScripts"):WaitForChild(Stand):Clone()
StandScript.Parent = Plr:WaitForChild("PlayerGui")
StandScript.Disabled = false
pcall(function()
Chr:WaitForChild("Animate"):Destroy()
local Animate = StandModel:WaitForChild("Animate"):Clone()
Animate.Parent = Chr
Animate.Disabled = false
StandModel.Animate:Destroy()
end)
local Hurtbox = Instance.new("Part")
Hurtbox.Parent = Chr
Hurtbox.Color = Color3.fromRGB(255,0,0)
Hurtbox.Material = Enum.Material.Neon
Hurtbox.Transparency = 1
Hurtbox.Size = Vector3.new(4.87, 5.27, 4.56)
Hurtbox.CanCollide = false
Hurtbox.Massless = true
Hurtbox.Name = "Hurtbox"
local Weld = Instance.new("Weld")
Weld.Parent = Chr.HumanoidRootPart
Weld.Part0 = Chr.HumanoidRootPart
Weld.Part1 = Hurtbox
end)
end)
My script only plays when the player joins the game, however, i need it to play when a character ALSO respawns, how can i do this?