I’m trying to get a “KatanaModel” from server storage to spawn on the players right hand when it spawns in, but my script is not working despite me having researched on how to do this for nearly an hour now not sure what I’m doing wrong hopefully someone can help.
my script currently:
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
if plr.Parent == game.Workspace.Attackable then
local partClone = game:GetService("ServerStorage").KatanaModel:Clone()
partClone.Parent = char.HumanoidRootPart
local weld = Instance.new("Weld", char.HumanoidRootPart)
weld.Part0 = char.HumanoidRootPart
weld.Part1 = partClone.Handle
weld.C0 = CFrame.new(0,0.6,0)
weld.C0 = CFrame.new(0,0,0) * CFrame.Angles(90, (90), 0)
end
end)
end)
The player is already automatically put into the “Attackable” folder you see in the script
The error to your script is that it parents the first model that wasn’t cloned (The original) with no welds, therefore we instead created the Welds before the Clone and then clone it with the Parent when we equip the model.
– Client Script –
Local UIS = game:GetService(“UserInputService”)
UIS.InputBegan:Connect(function(input, IsTyping)
If IsTyping then return end
If input.KeyCode == Enum.KeyCode.WhateverKey then
Remote:FireServer()
end)
– ServerScript –
Remote.OnServerEvent:Connect(function(plr)
Local char = plr.Character or plr.CharacterAdded()
Local Katana = game.ServerStorage.KatanaModel
Katana:Clone().Parent = Char
end)