local GET_REMOTE_EVENT = game.ReplicatedStorage.RemoteEvent:WaitForChild("PlantTreesOnServer")
local GET_TYPE_TREE = game.ReplicatedStorage.TreeStorageFolder:WaitForChild("StarterTree")
local Position up = CFrame.new()
local EventShowEffect = game.ReplicatedStorage.EffectEvent:WaitForChild("ShowEffectMoney")
GET_REMOTE_EVENT.OnServerEvent:Connect(function(Player, TreeHoles)
local PLAYER_DATA_TREE = Player:WaitForChild("TreeInfo")
local PLAYER_STATS_INFO = Player:WaitForChild("Stats")
local PLAYER_MIXED_STATS = Player:WaitForChild("MixedStats")
-- check ---
if TreeHoles.PlantedOrNot.Value == false then
local Clone = GET_TYPE_TREE:Clone()
Clone.Parent = TreeHoles
Clone.Position = TreeHoles.Position
local INFO_TREE = Clone:WaitForChild("TreeInfo")
local PROFILE = Clone:WaitForChild("Profile")
local STATS = Clone:WaitForChild("Stats")
-- setting up player profile --
PROFILE.ID.Value = Player.UserId
PROFILE.plrName.Value = Player.Name
-- putting player stats info in a folder ---
STATS.Level.Value = PLAYER_STATS_INFO.Level.Value
STATS.Money.Value = PLAYER_STATS_INFO.Money.Value
STATS.Diamond.Value = PLAYER_STATS_INFO.Diamond.Value
STATS.Planted.Value = PLAYER_STATS_INFO.Planted.Value
-- tree info set up --
INFO_TREE.OwnerTree.Value = Player.Name
INFO_TREE.MoneyGives.Value = PLAYER_DATA_TREE.MoneyGives.Value
INFO_TREE.DiamondGives.Value = PLAYER_DATA_TREE.DiamondGives.Value
INFO_TREE.Rarity.Value = PLAYER_DATA_TREE.Rarity.Value
INFO_TREE.TreeSkin.Value = PLAYER_DATA_TREE.TreeSkin.Value
INFO_TREE.TreeLifeTime.Value = PLAYER_DATA_TREE.TreeLifeTime.Value
INFO_TREE.TreeUpGradeName.Value = PLAYER_DATA_TREE.TreeUpGradeName.Value
-- turned on the script so tree can have lifetime ---
INFO_TREE:WaitForChild("DeleterLifeTime").Enabled = true
------------------------------------------------------------
---- GIVES MONEY AND MORE ---------------
------------------------------------------------------------
PLAYER_STATS_INFO.Money.Value += PLAYER_DATA_TREE.MoneyGives.Value
PLAYER_MIXED_STATS.TreeHave.Value -= 1
PLAYER_STATS_INFO.Planted.Value += 1
-- position the tree in PlantBox --
Clone.CFrame = CFrame.new(Vector3.new(Clone.CFrame.Position.X, 14.483, Clone.CFrame.Position.Z))
-- make treehole cant plant ---
TreeHoles.PlantedOrNot.Value = true
end
if TreeHoles.PlantedOrNot.Value == true then
print("Area allready planted")
end
end)