Textbutton working only for one player

So I have a menu screen and a “play” button in my game.

When i join the game and click it everything works just fine. But when another player joins it doesn’t work for them. I’ve tried clicking the button with some accounts and it only seems to work for me.

This is the script inside the button. Please tell me if there is anything wrong and why does the button work only for me (the creator)?

 script.Parent.MouseButton1Click:Connect(function()
 	
 	local Player = game.Players.LocalPlayer
 	local House = Player.leaderstats.House
 	local Camera = game.Workspace.CurrentCamera
 	
 	script.Magic:Play()
 	
 	if House.Value == "Sorting..." then
 		
 		script.Parent.Parent.Parent.Test.Visible = true
 		script.Parent.Parent.Visible = false
 		
 	elseif House.Value == "Gryffindor" then
 		
 		script.Parent.Parent.Parent.Enabled = false
 
 		script.Parent.Parent.Parent.Cameras.Disabled = true
 		game.ReplicatedStorage.Events.Character.TPG:FireServer(Player)
 		Camera.CameraType = Enum.CameraType.Custom
 		Camera.CameraSubject = Player.Character.Humanoid
 		
 	elseif House.Value == "Hufflepuff" then
 		
 		script.Parent.Parent.Parent.Enabled = false
 
 		script.Parent.Parent.Parent.Cameras.Disabled = true
 		game.ReplicatedStorage.Events.Character.TPH:FireServer(Player) 		 
                Camera.CameraType = Enum.CameraType.Custom
 		Camera.CameraSubject = Player.Character.Humanoid
 	
 		
 	elseif House.Value == "Ravenclaw" then
 		
 		script.Parent.Parent.Parent.Enabled = false
 
 		script.Parent.Parent.Parent.Cameras.Disabled = true
 		game.ReplicatedStorage.Events.Character.TPR:FireServer(Player)
 		Camera.CameraType = Enum.CameraType.Custom
 		Camera.CameraSubject = Player.Character.Humanoid
 		
 
 		
 	elseif House.Value == "Slytherin" then
 		
 		script.Parent.Parent.Parent.Enabled = false
 		
 		script.Parent.Parent.Parent.Cameras.Disabled = true
 		game.ReplicatedStorage.Events.Character.TPS:FireServer(Player)
 		Camera.CameraType = Enum.CameraType.Custom
 		Camera.CameraSubject = Player.Character.Humanoid
 		
 	end
 	
 end)

This is the part that doesn’t work:

if House.Value == "Sorting..." then
		
        script.Parent.Parent.Parent.Test.Visible = true
	script.Parent.Parent.Visible = false

Thanks for reading and sorry if this is a dumb issue.

1 Like

is House a string value or a Integer Value?

The value House is a string value.

is this a script or a local script?

The script inside the button is a local script

Are there any errors in the console? Can I see the GUI structure?

The console is completely empty

If I got what you mean this is the gui structure:

It seems that you have another script that changes the “House” string value. Can you should that script?

Data store issue? If the house value only works for your accoun that would mean that the house value in everyone else’s data would be probably a different string.

It has something to do with data stores. I disabled datastore script and when i joined it also didn’t work for me. But i still don’t know how to fix this.

I apologize for wasting your time. I found the issue. I called the value differently in the leaderstats script than the button script.
The value in leaderstats was “Sorting” and in the button it was “Sorting…”