pasje1312
(pasje1312)
February 24, 2023, 7:14pm
#1
I want to make a variable wich = to the players playerGui, but i cannot get it to work I’ve tried this.
local player = game.Players.LocalPlayer
local npcDialogueFrame = player.PlayerGui.MainGui.NpcDialogueFrame
Can someone please help me with a solution?
keremMCT
(Pepsi_Cat)
February 24, 2023, 7:15pm
#2
server or local script?
chjarr
If it’s a LocalScript then your thing should work, but if it’s a Script then you’ll have to use a different way of getting the player, since you can’t get LocalPlayer on the server by just calling it. Try maybe using a .Touched event or a .PlayerAdded event?
Server Script:
game.Players.PlayerAdded:Connect(function(player)
local npcDialogueFrame = player.PlayerGui.MainGui.NpcDialogueFrame
end)
Local Script:
local player = game:GetService("Players").LocalPlayer
local npcDialogueFrame = player.PlayerGui.MainGui.NpcDialogueFrame
Try this
system
(system)
Closed
March 10, 2023, 10:52pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.