Thorngard
(Thorngard)
March 5, 2020, 12:00am
#1
Hi, i have a script apply a specific skin to player after connection, but if the player die, he’s respawned without the specific skin my script is:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
local tete = player.status.Tete
local customCharacter1 = game.Lighting.Knight:Clone()
local customweapon1 = game.Lighting.WarriorSword:Clone()
tete.Changed:Connect(function(new_tete)
if tete.Value == 1 then
customCharacter1.Name = ("StarterCharacter")
customCharacter1.Parent = game.StarterPlayer
customweapon1.Name = ("Warrior Sword")
customweapon1.Parent = game.StarterPack
player:LoadCharacter()
wait(0.1)
script.Parent.Parent.StarterGui.Class.Frame:Destroy()
wait(0.1)
customCharacter1.Parent = game.Lighting
customweapon1.Parent = game.Lighting
end
end)
end)
end)
Thank you for your help
Where is this run in, and is it a regular script, or Local? Does either the Output or the Script Editor itself show any erros?
Thorngard
(Thorngard)
March 5, 2020, 12:17am
#3
It’s a regular script, i don’t have error the script work perfectly, but when a player respawn he don’t keep the skin and weapon ^^
I see the problem now, thanks. Try assigning the weapon and skin using the GetService function.
See these DevHub articles for more info:
Thorngard
(Thorngard)
March 5, 2020, 12:31am
#5
Sorry but im not expert i don’t understand how i can make this ^^
Instead of saying:
X.Parent = StarterPack
say:
X.Parent = game:GetService("StarterPack")
Thorngard
(Thorngard)
March 5, 2020, 12:45am
#7
Ok now i have this but it’s not working ^^ it’s same:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
local tete = player.status.Tete
local customCharacter1 = game.Lighting.Knight:Clone()
local customweapon1 = game.Lighting.WarriorSword:Clone()
tete.Changed:Connect(function(new_tete)
if tete.Value == 1 then
customCharacter1.Name = ("StarterCharacter")
customCharacter1.Parent = game:GetService("StarterPlayer")
customweapon1.Name = ("Warrior Sword")
customweapon1.Parent = game:GetService("StarterPack")
player:LoadCharacter()
wait(0.1)
script.Parent.Parent.StarterGui.Class.Frame:Destroy()
wait(0.1)
customCharacter1.Parent = game.Lighting
customweapon1.Parent = game.Lighting
end
end)
end)
end)
Make a new topic with more information if you want more help. I’m also a bit confused as to what’s wrong with this new script.
Ocipa
(Ocipa)
March 5, 2020, 12:51am
#9
put a print(1) inside of the tete.Changed event to make sure that the value is being changed and the event is firing, if it is being changed and fired then I have no idea why it would only work on the first respawn.
p.s. the if statement ends with a end)
I assume in your actual script, that is not the case since it would error
but make sure it is just end
Thorngard
(Thorngard)
March 5, 2020, 1:44am
#10
The print is firing in tete but not the character skin, so weird xD
Thorngard
(Thorngard)
March 5, 2020, 1:29pm
#11
nobody have a proposition for help ?