One thing, before continuing make sure the player exists.
So:
script.Parent.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if not player then return end -- Guard clause
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
game.StarterGui.Transition.Frame.Transparency = 0
wait(4)
player.PlayerGui.Transition.Frame.Transparency = 0
end
script.Parent.Touched:Connect(function(Object)
local player = game.Players:GetPlayerFromCharacter(Object.Parent)
if not player then return end -- if it isn't a player, stop the function.
--Stops the sounds
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
--Remember to use `PlayerGui` when trying to access players GUI
player.PlayerGui["FrameNameHere"].Transition.Frame.Transparency = 0
task.wait(4) --delay between these 2 actions
player.PlayerGui["FrameNameHere"].Transition.Frame.Transparency = 0
end)
None of these worked (probably not your guy’s faults) do I need to enable something in the settings? or does it have to be a local script? something like that…
You could simply use a local script[ since I dont see any server-sided needs here].
and clone the ui easier. [Put the gui under that local script]
game.Workspace.MyPart.Touched:Connect(function(Object)
local player = game.Players:GetPlayerFromCharacter(Object.Parent)
if not player then return end -- if it isn't a player, stop the function.
--Stops the sounds
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
script.Parent.Transition.Frame.Transparency = 0
task.wait(4) --delay between these 2 actions
script.Parent.Transition.Frame.Transparency = 0
end)
[You might need to adjust it to your gui frames etc]
Every player has their own personal PlayerGui, as you can see from this screenshot:
How it works is that every player’s PlayerGui contains their personal guis that only they see. If you only want one person’s gui to, for example, become transparent, you need to only modify the gui in their PlayerGui, but not anyone else’s.
This makes only Player1’s frame transparent, but nobody else’s. So Player1 can’t see the frame anymore, but everyone else can.
This should work:
script.Parent.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) -- Player equals the player that touched the part
if Player then
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
game.StarterGui.Transition.Frame.Transparency = 0
wait(4)
-- Modify the frame in the player who touched the part's playergui, so he alone sees it.
Player.PlayerGui.Transition.Frame.Transparency = 0
end
end)
I just hope this helped you understand how PlayerGui works more.
script.Parent.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) -- Player equals the player that touched the part
if Player then
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
game.PlayerGui.Transition.Frame.Transparency = 0 -- Everyone made this mistake
wait(4)
Player.PlayerGui.Transition.Frame.Transparency = 1
end
end)
This is a fix from his script because i believe he forgot to change the startergui
Also I’m pretty sure you make the transparency to 1 to make it invisible.
Then the GUI appears then disappears after 4 seconds
game.PlayerGui.Transition.Frame.Transparency = 0 -- Everyone made this mistake
wait(4)
Player.PlayerGui.Transition.Frame.Transparency = 1
what I left off with, you can work off of this if you want:
script.Parent.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) -- Player equals the player that touched the part
if Player then
game.Workspace.Sound1.Clash:Stop()
game.Workspace.Sound2.HorrorMusic:Stop()
game.Workspace.Polcie:Stop()
game.PlayerGui.Transition.Frame.Transparency = 0 -- Everyone made this mistake
wait(4)
Player.PlayerGui.Transition.Frame.Transparency = 1
end
end)