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

Changing properties through a script won't work in test mode but will in edit? Any help?

Here is my script: (It is suppose to change a value, make a gui invisible and then not disable the values parent which is a script)

Why won't this work in the game mode, it does work in the edit mode..

script.Parent.MouseButton1Click:connect(function()
	script.Parent.Parent.Parent.Parent.Move.Value.Value = 2
	script.Parent.Parent.Parent.Parent.Move.Disabled = false
	script.Parent.Parent.Visible = false
end)

i don't get it D:

2 comments

1

Is it a localscript? Where is it placed at? Be more descriptive

0

The script is placed in game.StarterGui.ItemsShop.a.TextButton

1 answer

✓ Accepted answer

Hello,

I suggest you use Local Scripts inside of the StarterGui Or ScreenGui. Scripts are for ServerScriptServices or Workspace. Server scripts also are for parts.

First, make sure you change this to a LocalScript inside of the button.

Next, make your script neater, add variables and make it easier for future edits.

LocalScript Code:

local Button = script.Parent
local MS = Button.Parent.Parent.Parent:WaitForChild('Move').Value.Value
local S = Button.Parent.Parent.Parent:WaitForChild('Move')

Button.MouseButton1Down:Connect(function() -- cap c
	MS = 2
	S.Disabled = false
	script.Parent.Parent.Visible = false
end)

We use Connect because connect is deprecated

WaitForChild is important as well.

Good Luck and Have Fun developing!

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