It's because you're changing the GUI that's in the StarterGui, and not in the PlayerGui. Every player has a PlayerGui, when they join the game everything in StarterGui gets moved into their PlayerGui. You have to get the player's PlayerGui and make changes to the GUI's that are in there.
Example: (ServerScript)
local Players = game:GetService("Players")
script.Parent.IfTouchedStartGUI.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
for _, Player in pairs(Players:GetPlayers()) do
if Player.Name == hit.Parent.Name then
local PlayerGui = Player.PlayerGui
local GuiWinScript = PlayerGui.ScreenGui.YouWin
GuiWinScript.TextTransparency = 0
GuiWinScript.BackgroundTransparency = 0.6
end
end
end
end)
Another Example: (Local Script)
Note, if this is in a local script, your local script has to be located in either, PlayerScripts, PlayerGui, the player's Character, Backpack or ReplicatedFirst. If the local script is inside the part, or in workspace then it won't work.
local Player = game.Players.LocalPlayer
local GuiWinScript = Player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("YouWin")
local IfTouchedStartGUI = game.Workspace:WaitForChild("SandwichBorderModel"):WaitForChild("IfTouchedStartGUI")
IfTouchedStartGUI.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
GuiWinScript.TextTransparency = 0
GuiWinScript.BackgroundTransparency = 0.6
end
end)
2 comments
Did you reset after you touched the ifTouchedStartGUI part?
Yes, it just wont change at all.