There is something wrong in my code, but idk whats the problem! Can you help me?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want that OliveTree give me the olives when i give him, food and water.

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to change variables and stuff. Nothing that I’m doing is giving me some positive answer, now im thinking that’s the Roblox Studio Bug. I wanna think the problem is me and not Roblox Studio, please help me!

-- This is an example Lua code block
local OliveTree = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TreeFruits = ReplicatedStorage.TreeFruits
local Water = script.Parent.Water
local Earth = script.Parent.Earth 
local Winter = "Winter"
local Summer = "Summer"
local Spring = "Spring"
local Autumn = "Autumn"

function fertilizing()
	Water.Transparency = .5
	wait(5)
	Water.Position =  Water.Position - Vector3.new(0,0.1,0)
	wait(3)
	Water.Transparency = 1 
end
workspace.Water.water.ClickDetector.MouseClick:Connect(fertilizing)

function takingthefertilizating()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local adubo = ReplicatedStorage.adubo
	local clicked = 0
	local player
	local treesfood = workspace.Fertilization.treesfood.ClickDetector
	treesfood.MouseClick:Connect(function(hit)
		clicked = clicked + 1
		if clicked == 1 then
			local Adubo = adubo:Clone()
			Adubo.Parent = OliveTree
			wait(4)
			Adubo.Parent = ReplicatedStorage
		end
	end)
end
takingthefertilizating()

function photosynthesisprocess()
	--This is not a problem for while
end

function givingtoplayerfruits()
	fertilizing()
	
	if fertilizing and takingthefertilizating then
		local treefruits = TreeFruits:Clone() 
		treefruits.Parent = OliveTree	
	end

end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Have you tried putting prints in to show you the values of the variables you are setting and where?

The screenshot doesn’t actually show what’s going wrong. Please describe what you want to happen in detail, and also what actually happens.

Hey! Could you give me the roblox file and I’ll see what’s up?