Hello, I am trying to make +1 show up with a local script when touching a part. So far I tried enabling and disabling the ScreenGui. Ive tried making the TextLabel visible to not visible. (they start off disabled/not visible.)
I have the local script inside the part for future easy copy/paste for different parts instead of making new ScreenGuis over and over again.
Here is the script I am currently trying to use
---- Local Script inside the Berry part ---
local ScreenGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui") -- Screen that is being turned on and off
local oneRedBerry = game.Workspace.oneRedBerry -- Berry that is being collected
oneRedBerry.Touched:Connect(function(hit) -- Touching Berry
local Humanoid = hit.Parent:FindFirstChild("Humanoid") -- Find Humanoid
if Humanoid then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Find Player
if Player then
wait(0.5) -- Wait till ScreenGui "Pops Up"
ScreenGui.Enabled = true
wait(1)
ScreenGui.Enabled = false
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players:FindFirstChild(hit.Parent.Name) then
wait(0.5)
game.Players:FindFirstChild(hit.Parent.Name).ScreenGui.Enabled = true
wait(1)
game.Players:FindFirstChild(hit.Parent.Name).ScreenGui.Enabled = false
end
end
end)
This should work just remember you cannot get the LocalPlayer if it is not a localscript, and localscripts cannot go in workspace, because you need one for each player.
Hey I am not sure if you knew this, but you can’t access playergui with normal script. About the solution, he gets all players that touch that part, he should check if that player is local player and make gui pop up (his script didn’t work because you can’t access other people’s playergui aswell and it should be in playerscripts,startergui or other containers that serve that role.
Huh? I dont understand what you’re talking about, and yes you can access playergui with a normal script, i use it all the time for my saving and loading script or other scripts. So maybe search stuff up?
@LukeBLOXDaily So the code you gave me, is it supposed to be in a server script instead of a local script? Also Ive tried putting my original script inside the ScreenGui which is inside the StarterGui and the gui still doesnt pop up. Imma keep fidgeting
Eh keep it where it is, simply change the code in script. Im not sure but i think you said the script is in block (berry) you touch. If so the script should work perfectly
Sorry i think you have it wrong. You cannot access any PlayerGui’s appart from your own in a localscript, in server scripts you can acess everything in the game.
In case you still don’t understand you can look at @Maximum_ADHD 's reply on this post as I don’t want to search it in roblox docs
Source: Accessing PlayerGui in FE
I don’t know what else I could do, if you don’t know that it doesn’t replicate to server (common sense) and don’t want to look at top developers posts to understand there is not much left.
What top developpers do does not concern me, my scripts work using everything he needs so im simply giving him the same type of script, if it does not work there is another simple way to do it but hey it works for me i dont know why it wouldnt work for ANYONE else in the entire world, and that isn’t really my problem. Anyways im jsut trying to help him if it does not work he can tell me since it should work from personal experience.
And btw it is the client that is replicated from server, any changes made inside client will not be made inside server, but changes made inside server will be made inside client.
Lol dude. If you change a gui transparency form client, it wont change in server, PlayerGui is still accessible from server to any clients PlayerGui. Please just stop arguing on this dumb conversation. Ill fix it myself if it does not work. I always change gui’s inside server that way if i need to access them from another player, like i need to in my game, i can easily without having the wrong information.