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

i'm having trouble opening and closing a frame am i missing something?

Asked by 6 years ago

script is in serverscriptserv and the button in startergui in the screengui called introbeam.

what i'm trying to do is to get this script to visible a frame then invisible a frame. but seems to be not working..

frame = game.StarterGui.IntroBeam

Event = game.ReplicatedStorage.BlackEvent
Event.OnServerEvent:Connect(function(plr,Gui)
if Gui == "On" then
    if frame.Beam.Visible == false then
        frame.Beam.Visible = true
    elseif frame.Beam.Visible == true then
        frame.Beam.Visible = false
        end

end
end)

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

you cant access a gui using local script which your using a server script in ServerScriptService which would work in studio but not ingame. just switch the normal script(server script) to a local script inside your gui called Beam. also i wouldnt suggest using StarterGui to access a gui since its called StarterGui so you would need to reset, just use the player's PlayerGui like this example:

local player = game.Players.LocalPlayer

player.PlayerGui.frame.Beam.Visible = false

also you could use the not function, so you wouldnt need to use a bool value to toggle or the method of some sort that your using and you dont need remote events for this.

example script

script.Parent.Visible = not script.Parent.Visible -- "not" is like a toggle and you can use it in if statments, but it wouldnt be a toggle  

i didnt show the full script since you werent that descriptive and i dont know whats gui and you didnt show the script that fired the event

0
Thank you! A1exTatum 57 — 6y
0
np User#23365 30 — 6y
0
ok sorry to come back to this topic but, it now only works in studios and not in game.. buttons are local script and serverscriptserv is a reg script. A1exTatum 57 — 6y
0
whats the "reg" script User#23365 30 — 6y
View all comments (7 more)
0
because this would work, its probably that your using it wrong User#23365 30 — 6y
0
serverscript A1exTatum 57 — 6y
0
so whats the serverscript suppose to do User#23365 30 — 6y
0
thats whats in the serverscriptservices which is how i get the which is where i trigger the event or something like that. but i don't see any errors and it does work the way i want it to work but only in studios A1exTatum 57 — 6y
0
you dont need a remote event as i said in my answer User#23365 30 — 6y
0
only if it was something that could be done by the server only you would need remote events, if there isnt just use a local script User#23365 30 — 6y
0
i'll figure it out, thanks for the help. :) A1exTatum 57 — 6y
Ad

Answer this question