A script that makes a Frame visible, when testing it, property of the Frame "visible" is true but i can't see it
stepblock = game.Workspace:WaitForChild("housestep") housemodel = game.Lighting.house phone = game.StarterGui.phone.Frame.toggle ftointeract = game.StarterGui.ui.Frame.ftointeract print("working") function lightOnFire(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then phone.Disabled = true print("working2") ftointeract.Visible = true print("working3") end end stepblock.Touched:connect(lightOnFire)
A few things of note here.
Firstly, you shouldn't store anything that isn't related to lighting in game.Lighting
, it should go into game.ReplicatedStorage
if it needs to be replicated to the client at all times, or game.ServerStorage
if it does not.
game.StarterGui
is the template for all GUIs that get cloned into the player's Player.PlayerGui
folder. Modifying it merely modifies the template.
In your BasePart.Touched
listener, just so you're aware, this will fire when any part with a humanoid touches it. We also shouldn't assume that the part has a parent when the event listener fires. I'm going to assume you really wanted to check if it was any player that touched the part:
function onStepBlockTouched(touchPart) if not touchPart.Parent then return end local player = game.Players:GetPlayerFromCharacter(touchPart.Parent) if not player then return end -- Modify GUI stuff as needed. end)
Additionally, RBXScriptSignal:connect()
is deprecated, so you should prefer RBXScriptSignal:Connect()
.
You index the gui template inside StarterGui
, while the gui that player sees is in their PlayerGui
. This is a common mistake.
Put this script into a Script and parent it to the stepblock:
script.Parent.Touched:connect(function(hit) if hit.Parent.ClassName == "Model" then local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if not plr then return end plr.PlayerGui.phone.Frame.toggle.Disabled = true plr.PlayerGui.ui.Frame.ftointeract.Visible = true end end)
StarterGui should not be confused with the Player's PlayerGui, because when a player spawns their gui is cloned and moved from StarterGui which could effect all the gameplay,
you should use :GetPlayerFromCharacter() and change a few things in the script
local stepblock = workspace:WaitForChild("housestep") local housemodel = game.Lighting.house stepblock.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local ser = game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui ser.phone.Frame.toggle.Disabled = true ser.ui.Frame.ftointinteract.Visible = true end end)