So, basically I have a sunglasses tool when activated its suppose to enable a frame which darkens the players view. But when I do this the frame doesn’t pop up. Please help, this tool is a main part of my game.
Yea you know it would be REALLY helpful if you showed us the script and gave us a little bit more detail
okay ;( sowwy
local rep = game:GetService("ReplicatedStorage")
local startergui = game:GetService("StarterGui")
local sunglasses = rep.Sunglasses
local sound = sunglasses.Sound
script.Parent.Activated:Connect(function()
startergui.gui.Frame.Visible = true
wait(0.4)
sound:Play()
local sunglassClone = sunglasses:Clone()
sunglassClone.Parent = script.Parent.Parent
wait(0.05)
script.Parent:Destroy()
end)
It’s because you need to access the frame from PlayerGui, not StarterGui
Make a GUI with a low transparency (black or grey) and make it visible when you have sunglasses on or off
Ah, okay. How do I get player gui?
if this is a local script
game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
Is the script you are using a localscript?
No, i will change that actually.
You can use a remote event to communicate to a localscript
when the player enters the game everything in StarterGui will be cloned and placed in PlayerGui, change game.StarterGui
to game.Players.LocalPlayer:WaitForChild("PlayerGui")
(only works in a local script)
It seems to be working thank you.
1 Like