I have looked at it time and time again and cannot figure out what is wrong with it. There is no error in the output. When you click one of the points to place the sand drill and other items it should change a value called "Placed" from false to true and therefor should give the player resources.
--// Modules
local resourceModule = require(script.Parent.Parent.Parent.Parent.ModuleScripts.Resource)
--// Sand Drill
local sandDrillInputs = {
leaderstatName = resourceModule.sand[1];
delayTime = resourceModule.sand[2];
ammount = resourceModule.sand[3];
}
--// Solar Drill
local solarDrillInputs = {
leaderstatName = resourceModule.solarpower[1];
delayTime = resourceModule.solarpower[2];
ammounr = resourceModule.solarpower[3];
}
--// Services
local ws = workspace
local rs = game.ReplicatedStorage
--// Objects
local sandDrill = rs.Parts:WaitForChild("SandDrill");
local solarDrill = rs.Parts:WaitForChild("SolarDrill");
local solarShield = rs.Parts:WaitForChild("SolarShield");
--// Values
local sandDrillPlaced = sandDrill:WaitForChild("Placed");
local solarDrillPlaced = nil;
local solarShieldPlace = nil;
--// Scripts
for _,plr in pairs(game.Players:GetPlayers()) do
sandDrillPlaced.Changed:Connect(function()
if sandDrillPlaced.Value == true then
while wait(sandDrillInputs.delayTime) do
if plr and plr.leaderstats and plr.leaderstats[sandDrillInputs.leaderstatName] then
plr.leaderstats[sandDrillInputs.leaderstatName].Value = plr.leaderstats[sandDrillInputs.leaderstatName].Value + sandDrillInputs.ammount
end
end
end
end)
end
Here is the script that places the object "Sand Drill"
--// Sand Drill
local source = game.ReplicatedStorage.Parts:WaitForChild("SandDrill")
--// | SD
repeat wait() until source
--// Sand Drill Points
local folder = workspace.Points
local points = folder:WaitForChild("SandDrillPoints")
local placed = source.Placed.Value
--// Sand Drill Function V1.0
for _,v in pairs(points:GetChildren()) do
if v.ClickDetector then
v.ClickDetector.MouseClick:Connect(function()
source.Parent = workspace
wait()
source:SetPrimaryPartCFrame(v.CFrame)
placed = true
end)
v.ClickDetector.MouseHoverEnter:Connect(function()
v.Color = Color3.fromRGB(0,255,235)
end)
v.ClickDetector.MouseHoverLeave:Connect(function()
v.Color = Color3.fromRGB(163, 162, 165)
end)
end
end

11 comments
I am assuming it has to do with the loop and the changed function, other than that idek
https://scriptinghelpers.org/help/how-post-good-questions-answers
tell us the problem ur having
I'll give you about an hour to be descriptive, cause this is an easy moderation claim
lol ur mum
Well there is no error in the output so I have no idea what is wrong with it.
What else do you suggest I describe? It's all in the title. "I have no idea what is wrong with this script please help me."
Does the script do anything at least? Try adding prints to see if the script runs through completely.
I have.
You should try using a PlayerAdded event on line 27 in the first script. You’re only going through all the players once.
Doesn't work.