Why does my script don’t work?

Hi guys I have created a local script that should set the enabled to false when a button is get clicked. Why isn’t this working?

2 Likes

It should be on the client side via the gui.

The starter GUI later on gets cloned automatically to the playerGUI.

To fix the script.

You should do:

script.Parent.Something --Something lets say the button.
4 Likes

LocalScript do not work in ServerScriptService

Put the LocalScript in StarterGui
and change it to this:

local danceButton1 = script.Parent.Button1
local danceStart = danceButton1.Start
local exitGui = script.Parent.Exit -- do not name variables exit

danceStart.MouseButton1Click:Connect(function()
    danceButton1.Enabled = false
end)
3 Likes

Okay but for example I want to make that when the player taps the button it is enabled to false and than (I have created a round small button) this round button should spawn on positions that I have set to it on a script . I don’t think that I can do this in gui

1 Like

You can connect them between.

You could read the roblox docs:

You can find some other useful information there.

REMEMBER! Anything is possible! as roblox motto says Powering Imagination!

1 Like

I want that i make a script when the button is clicked it is not enabled than the round button spawns 2 times in the middle of the screen when it isn’t tabbed after 2 sec these buttons despawns when it is tabbed you get 100XP per button and when you missed it will spawn 1 2 or three buttons in a new position with the same process until all buttons have spawned

You can do what I said then use RemoteEvents to communicate between the Server and Client and for your use case you don’t even need to communicate bettween the Server and Client as you can change the character’s CFrame on the Client and it will change on the Server

Oh gosh this is my first script project and I’m not an experienced scripter

Is this complicated? To make for me

It should be pretty simple. It would be more helpful if you could explain more specifically what you want. As @aabols2010 stated before, you should read through the Creator Docs to learn more scripting. Coding Fundamentals | Documentation - Roblox Creator Hub

1 Like

Okay do you know an OSU system I want to make one like that

You have to go step by step, you can’t just ask to recreate an entire game system. Start at the fundementals then you can build up.

Please first learn the basics we can’t just provide you everything

Okay and why this script don’t work too in the gui

Nerver mind. i didn’t understand it.

it should be

local gui = button.Parent.Enabled = false

I only want that when i click on the Butten it will set the propertie enabled to false :joy::joy::joy::joy::joy:

Well yeah that’s what i corrected for you.

2 Likes

Hello!

You should try doing:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild(“PlayerGui”)

local button = script.Parent
local ButtonGUI = PlayerGui:FindFirstChild(“ButtonGui”)

This is because StarterGui is destroyed once the game starts and any GUIObjects are replicated into PlayerGui.

Hope this helps! :slight_smile:

1 Like

But one question sorry for asking I’m new in scripting but what does this script :slightly_smiling_face:

1 Like

Don’t be sorry! Ask as many questions as you need! The more you know, the better you’ll be!

If you’re asking what this script does, it basically just gets the Player so we can access PlayerGui. Like I said before, when the game starts, StarterGui is destroyed and its children are added to the PlayerGui. You could also say:
local gui = button.Parent

Did I answer your question?

1 Like