My gui does not function properly when playing my game in roblox, but works fine while testing in roblox studio

im using a local script for when the player presses “q” it will make the gui visible/not visible, this works fin in roblox studio, but when i go to play the game in roblox it does not work at all

2 Likes

Could you paste your code? We can help you diagnose the issue better that way.

1 Like

If you’re referencing game.StarterGui then thats your issue, use game:GetService('Players').LocalPlayer.PlayerGui

If you’re using a Server Script, then that’s your issue, they are only for the server use not the client. Use a Local Script for client activity.

Those are the common mistake I see, however so we can properly see the issue, send the relevant code in ``` marks. Should look something like this

3 Likes

Please try and not spam messages. Edit it if needed.

Just send the relevant code to the situation.

mouse.KeyDown:connect(function(key)
if key == ‘q’ then
Build = not Build
if Build == false then
BuildOff()
elseif NewPart == true then
Dragger:MouseMove(mouse.UnitRay)
part.Transparency = 0.5
end

  if Build == true then
  	if PrimaryBox then
  		PrimaryBox.Transparency = 0
  		if PrimaryBox.Color3 == Color3.new(0.5,0,1) then
  			PrimaryBox.Color3 = Color3.new(0,0.5,1)
  		end
  	end
  	BoxCheck()
  	Sbuild.Text = "Build: On"
  	Sbuild.BackgroundColor3 = Color3.new(0, 1, 0)
  	Sbuild.TextColor3 = Color3.new(0, 0, 0) 
  	Switch.Text = "Turn Off:"
  	BuildStats.Visible = true
  end

end

1 Like

Can you send the variables you’re using.

Also, KeyDown is deprecated, use UserInputService.InputBegan
You can read about it here.

Building off what Sovereign said, you should post the entire thing or at least the unknown variables and functions which you’re referencing.

1 Like

here are the variables that are important to this issues, im not gonna post of all them since it isnt necessary

local Player = game:GetService’Players’.LocalPlayer

local char = Player.Character–Added:wait()

local mouse = Player:GetMouse()

local Frame = script.Parent.Frame

its specifically “build stats.visible = true” that is not working

local char = Player.Character–Added:wait()

Use this instead

local char = Player.Character or Player.CharacterAdded:Wait()

(chances are the character already loaded in live server before the script ran which is why your script might not be working)

1 Like

What about Build, BoxCheck(), BuildOff(), SBuild, Switch, and BuildStats. There are still many more which you haven’t given. It’s much harder to understand and help you fix your issue with these missing references.

it works all works fine in studio, and certain aspects of the the gui work in roblox, like the text changes. but certain things like the color of certain text boxes aren’t changing, and the frame (the one i have referred to in the script) is not going visible when the key is pressed, while playing the game in roblox. so i don’t believe it has to do with the character

those arent important and have nothing to do with the issue, ignore those

Debug your code.

Add prints and test it in a live server to see what parts aren’t running and we can go from there.

oh right except for build stats i forgot about that one

local BuildStats = Frame.BuildStats

these aswell, but if you can find a solution to fix one of them all of them will work

local Sbuild = Frame.BuildStatus

local Switch = Frame.Switch

like i said all of it works fine in studio

it while playing in roblox that it doesn’t work

Just because it works fine doesn’t mean it’ll completely work ingame.

Like I said before, debug the code. Add prints and find out where the script stop.

well the text changes like its supposed to, and some of those line of codes come after the ones that arent functioning,

Which lines are the ones that supposedly aren’t running?

Sbuild.BackgroundColor3 = Color3.new(0, 1, 0)
Sbuild.TextColor3 = Color3.new(0, 0, 0) (this one i’m not sure because the text is not white to begin with like it should be while playing in game)

BuildStats.Visible = true

This is black (0,0,0) and green (0,1,0) if I’m not mistaking. if you want to make it white put in Color3.fromRGB(255,255,255)

1 Like