hello im trying to make a Devil Fruit System where if u eat a fruit player:LoadCharacter() gets fired then a value in your player gets changed. And all im trying to do is to make a script where every time you respawn it detects the value then it gives weapons based on the value.
heres what i tried to do.
game.Players.PlayerAdded:Connect(function(player) -- player joins game
if not player:WaitForChild'Data Folder' then return end
if player:WaitForChild'Data Folder'.Fruit.Value == "" then
player:WaitForChild'Data Folder'.Fruit.Value = "None" -- changes the value of it
end
if player:WaitForChild'Data Folder'.Fruit.Value == "Devil Fruit" then -- detects once the player eat fruit
for _,v in pairs(game.Lighting.Skills.DevilFruit:GetChildren()) do
local copies = v:Clone() -- tools
copies.Parent = player.Backpack -- in backpack
end
end
end)
