Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

{Please Help!} Why is this script working in Studio Mode, but not in Player Mode?

This is getting a little aggravating I am trying to make this script work, but it works in studio mode and not in player mode and I don't know why! My output is saying nothing is wrong with the script!

Where they are: --Price and Wait are IntValues in the Potato Script. --Main script is in Soil --Potato script is in Soil

In the chopping the crop down script I have the enable script. Why is this not working :(

script:

 
local Cash = game.Players.LocalPlayer.leaderstats.Cash
local Price = script.Price.Value
local carrot = script.Parent.Parent.Carrot
local corn = script.Parent.Parent.Corn
local wheat = script.Parent.Parent.Wheat
local potato = script.Parent.Parent.Potato
local pumpkin = script.Parent.Parent.Pumpkin
local Let = script.Parent.Parent.Lettuce
local On = script.Parent.Parent.Onion
local Rice = script.Parent.Parent.Rice
local PA = script.Parent.Parent.PotatoA
local PB = script.Parent.Parent.PotatoB
local PC = script.Parent.Parent.PotatoC


potato.Touched:Connect(function(TouchedA)
	if Cash.Value >= Price then
		Cash.Value = Cash.Value - Price
		script.Disabled = true
		script.Parent.Main.Disabled = true
		script.Parent.Wheat.Disabled = true
		script.Parent.Corn.Disabled = true
		Let.Transparency = 1; On.Transparency = 1; Rice.Transparency = 1; carrot.Transparency = 1; corn.Transparency = 1; wheat.Transparency = 1; potato.Transparency = 1;pumpkin.Transparency = 1
		Rice.SurfaceGui.Enabled = false; On.SurfaceGui.Enabled = false; Let.SurfaceGui.Enabled = false; pumpkin.SurfaceGui.Enabled = false; carrot.SurfaceGui.Enabled = false; corn.SurfaceGui.Enabled = false; wheat.SurfaceGui.Enabled = false; potato.SurfaceGui.Enabled = false;
		wait(1)
		PA.Transparency = 0
		wait(5)
		PA.Transparency = 1
		PB.Transparency = 0
		wait(5)
		PB.Transparency = 1
		PC.Transparency = 0
		PC.Collect.Disabled = false
		script.Disabled = true
	elseif Cash.Value <= Price then
		script.Parent.Main.Disabled = false
		script.Parent.Corn.Disabled = false
		script.Parent.Wheat.Disabled = false
		PC.Collect.Disabled = true
		script.Disabled = false
		Cash.Value = Cash.Value - 0
	end
end)

5 comments

0

is this in a local script?

0

Is your game filtering enabled?

0

neither of them worked

0

If you actually test it out in Roblox Studio by creating a test server, then it should give you a few errors. Make sure that the "Server" checkbox is checked, then press the "Start" button under the "Test" tab.

1 answer

✓ Accepted answer

Your problem is that you use LocalPlayer well that's the problem... It works only in StudioMode but if you go in Online Mode it wont work....

3 comments

0

See if that work?

0

That will work, because Roblox Studio cannot read your mind on what you want to happen. It just follows the code that it been instructed to do.

0

what do I use instead of localplayer for that specific player?

This discussion is preserved as it was. New answers, comments, and votes are closed.