Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TextButton/ImageButton not working w/ ServerScript?

Asked by 8 years ago

It's been a while since I've scripted using GUI's and I seem to be having a problem. I'm trying to make a new Menu gui for my game and I can't seem to get the ServerScript to work w/ any of the buttons. The way the Menu works is, each section is it's own Frame, so I have multiple frames in one gui, and I want to use one script per frame for all the different buttons. Here's the first script for loading and starting a new game:

frame = script.Parent
gui = frame.Parent
pgui = gui.Parent
player = pgui.Parent
New = frame.New
Load = frame.Load
Data = player.Data
enabled = true

function NewGame()
if enabled == true then
enabled = false
for i,v in pairs(Data:GetChildren()) do
if v:IsA("StringValue") then
v.Value = "Blank"
elseif v:ISA("NumberValue") then
v.Value = 0
end
end
gui.Menu.Visible = false
wait(0.5)
gui.Chakras.Visible = true
end
wait(0.2)
enabled = true
end

function LoadGame()
if enabled == true then
enabled = false

wait(0.2)
enabled = true
end
end

New.MouseButton1Click:connect(NewGame)
Load.MouseButton1Click:connect(LoadGame)

I've tried switching to LocalScript and it works just fine, however I want to avoid using LocalScripts if possible, any advice?

0
Are you using FilteringEnabled? Input-driven events don't work on regular Scripts when FilteringEnabled is on. User#6546 35 — 8y
0
Avoiding the use LocalScripts for things that only affect the client is typically considered bad practice. Why do you want to avoid them exactly? BlackJPI 2658 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Not using local scripts makes no sense in this situation. Do you understand the difference between local and regular script?

In short, local script runs directly on client's computer, while regular script runs on the server machine, that has nothing to do with visual and rendering related stuff.

It would be good if you explained why you want to avoid using local scripts, because I don't understand which is your misconception here.

Ad

Answer this question