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

local script will not run. where do i put it to make it run properly?

code:

local player = game:GetService("Players").LocalPlayer
local event = game:GetService("ReplicatedStorage"):WaitForChild("ClickEvent")

local function clickEvent()
 player.PlayerGui.Hosvi.Frame.Visible = true
print("epic")
end

event.OnClientEvent:Connect(clickEvent)

It returns no errors. It does nothing.

It waits for the event to run, which it does, but then nothing happens.

3 comments

0

game:GetService(‘Players’).LocalPlayer:WaitForChild(‘PlayerGui’)

0

local scripts can run inside StarterGui, StarterPlayer, StarterPack, inside the players character and ReplicatedFirst

3 answers

Try Putting It In StarterGui or StarterPlayerScripts

1 comment

0

did not workkk

I personally believe the best place to put localscripts is in the StarterPlayerScripts. Some people believe starterpack and or startergui is better. I firmly disagree with this and I will now tell you why.

Why not StarterPack

StarterPack is used for tools, not scripts. End of story.

Why not StarterGui

StarterGui is for Guis, not scripts. End of story.

Why StarterPlayerScripts

StarterPlayerScripts is for scripts, in particularly localscripts. End of story

1 comment

0

i usually put mines inside StarterGui so _(^^)/ 

If the script is not running it is either disabled or misplaced. The wiki lists where localscript can run:

A Player’s Backpack, such as a child of a Tool

A Player’s Player/Character|character model

A Player’s PlayerGui

A Player’s PlayerScripts.

The ReplicatedFirst service

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