-
What do you want to achieve? Keep it simple and clear!
whenever the player is added a “Case” will be added to the character
-
What is the issue? Include screenshots / videos if possible!
it doesn’t detect and doesn’t add it and doesn’t print “Player added should add case” -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i did it brought up this module that was kinda complicated for me. i just wanted to add a player added function it doesn’t seem to work and it worked before
full Script:
--//services
local RP = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--//Variables
local CaseRP = RP.Models.Case
--// Player/Char
local Player = Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Torso = Char:WaitForChild("Torso")
local TorsoCF = Torso.CFrame
local AddCase = RP.Events.AddCase
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
print("Player added should add case")
AddCase:FireServer(CaseRP, char:WaitForChild("Torso"), char:WaitForChild("Torso").CFrame)
end)
end)
-- server script
game:GetService("ReplicatedStorage").Events.AddCase.OnServerEvent:Connect(function(plr, CaseRP, Torso, TorsoCF)
local Char = plr.Character
--//Case
local Case = CaseRP:Clone()
Case:SetPrimaryPartCFrame(TorsoCF)
Case.Parent = Char
--//Motor6D
local Motor = Instance.new("ManualWeld")
Motor.Parent = Torso
Motor.Name = "CaseMotor6D"
Motor.C0 = Case.PrimaryPart.CFrame
Motor.C1 = TorsoCF
Motor.Part0 = Torso
Motor.Part1 = Case.PrimaryPart
local LeftHand = Instance.new("Part", plr.Character["Left Arm"])
LeftHand.Name = "LeftHandHitBox"
LeftHand.Transparency = 1
LeftHand.Size = Vector3.new(1,0.7,1)
local LeftHandWeld = Instance.new("Weld", plr.Character["Left Arm"])
LeftHandWeld.Part0 = plr.Character["Left Arm"]
LeftHandWeld.Part1 = LeftHand
LeftHandWeld.C1 = CFrame.new(0,1,0)
local RightHand = Instance.new("Part", plr.Character["Right Arm"])
RightHand.Name = "RightHandHitBox"
RightHand.Transparency = 1
RightHand.Size = Vector3.new(1,0.7,1)
local RightHandWeld = Instance.new("Weld", plr.Character["Right Arm"])
RightHandWeld.Part0 = plr.Character["Right Arm"]
RightHandWeld.Part1 = RightHand
RightHandWeld.C1 = CFrame.new(0,1,0)
end)
I am losing it on this lool