Alright get a load of this. Im working on a tycoon with a friend of mind and when I test it on studio when the tycoon stuff reach the part that sells them it works. Though when the other guy tests it it doesnt work. When I go into team test it doesn’t work. When I click test under the test tab it works. When i play it in normal roblox it doesn’t work. There are no errors in the output. What the heck is going on!?!?
Here is the script:
local function addPoints(points)
local player = tycoon.TycoonOwner.Value
if player then
local money = player.leaderstats.Tokens
money.Value = money.Value + points
end
end
local function sellObject(part)
if part.Parent.Name == "Water pistol" then
addPoints(1)
part.Parent:Destroy()
elseif part.Parent.name == "cWater pistol" then
addPoints(3)
part.Parent:Destroy()
elseif part.Parent.name == "uWater pistol" then
addPoints(6)
part.Parent:Destroy()
elseif part.Parent.name == "uuWater pistol" then
addPoints(10)
part.Parent:Destroy()
end
end
local function onTouched(otherPart)
if otherPart:IsDescendantOf(objectsFolder) then
sellObject(otherPart)
end
end
deposit.Touched:Connect(onTouched)