Still have questions? Join our Discord server and get real time help.
Log in to vote

how to make a frame visible w/ click detector? (instarterplayerscipts)

Asked by 8 months ago
Edited 8 months ago
its a localscript also its in starterplayerscripts

local GUI = UI local Button = GUI.Button
local player = game.Workspace.localPlayer
    local repStorage = game:GetService("ReplicatedStorage")
    local remote = repStorage:FindFirstChild("ButtonClick")
    mouse = player:GetMouse()
    local idoit = game.Workspace.CHING.ClickDetector
    UI = game.StarterGui.KiKidied.Frame --idk why i named it that no judge


    UI.Visible = true


misspelled 'idiot' lol unsatisfie_d 1449 — 8mo
uhhhhh natonator63 15 — 8mo

1 answer

Log in to vote
Answered by
xPolarium 1337 Moderation Voter
8 months ago
Edited 8 months ago

You're not using the correct event for the ClickDetector. The correct event is 'MouseClick'. You're also not defining the GUI that the player sees. Every GUI you have in StarterGui will be cloned and given to a player's PlayerGui each time they spawn. StarterGui is just a folder the server sees and the client wont be able touch it.

--Prefedine services you'll use at the top
local Players = game:GetService("Players")
local RepStorage = game:GetService("ReplicatedStorage")

--You get local player from the Players service
local player = Players.LocalPlayer

--Localize those variables
local mouse = player:GetMouse()

--Don't understand this but ok
local remote = RepStorage:FindFirstChild("ButtonClick")

--Since we're in a local script, you should wait for things to load
local idoit = workspace:WaitForChild("CHING"):WaitForChild("ClickDetector")

local PlayerGui = player:WaitForChild("PlayerGui") -- idk why this needs to wait

--assuming you have a GUI named Kikidied and a Frame inside of it
local UI = playerGui:WaitForChild("KiKidied"):WaitForChild("Frame")

    UI.Visible = true

Some things to note is to make better names for variables and how you define objects/instances. You can also use the Object Browser located in the 'View' tab in Studio to get quick info on the functions, events or properties of a certain object.


Answer this question