#Clone function isn't working
1 messages · Page 1 of 1 (latest)
Script fragment for reference:
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local usern = player.Name
local nickn = player.DisplayName
local gui = game:GetService("StarterGui").MenuGui.PlayerFrame
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(plr, voting)
if voting == true then
local i = unit:Clone()
i.Parent = gui
i.Name = usern
i.TextLabel.Text = nickn
i.Visible = true
else
gui:WaitForChild(usern):Destroy()
end
end)```
maybe you need more nesting
does the event ever reach the client?
yes i print debugged it
maybe you need to stop hating on nests...
show :fireclient() code
did u get it fixed?
ur right unreadable code is great
its not my fault you cant read code unless its a literal lineof text on a whole script ;-;
nough
game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(plr, voting)
game:GetService("ReplicatedStorage").PlayerIcon:FireAllClients(plr, voting)
end)```
i mean my code works and im not the one whos asking for help but isnt taking logical advice
if your code worked so well you'd have been able to fix mine without being so nestphobic
also this is not the point rn im trying to solve a clone problem
im just trying to help people faster, if you come here 3x a day and ask for help and it takes me half an hour to figure out what your code should be doing thats time consuming
"help people faster" you tried to make me redo my script from scratch and a few hours later i found that by replacing a custom function with the things it had inside solved the problem, idk about that
also now that i think about it no its not nesting more its in fact nesting less since i removed a layer which would be the custom function itself
;-;
anyways!
"swame issue"
do you realise
earlier issue
was solved
by doing something totally unrelated
😭
yk what solve your things yourself
also i kinda do need the plr parameter...
im making a player thingie like piggy so no shit i have to load all the info from the remote event
ITS A FUCKING LOCAL SCRIPT DO Players.LocalPlayer
You just dont understand roblox game engine and your also not taking advice
the whole point of remote events is to avoid having to always reoccur to loops
Your like a patient for a doctor that is not taking his medicine the doctor gave him
besides the whole client server communication thingie*
your spelling is hurting my eyes
atleast you know how to spell nest you made sure about that 💜
your gonna quit coding in the next week anyway why am I even caring abt this
yeah bc you flooding my thread not even being helpful "omg im gonna crashout" but then you stay all the time following me like a fly to the shit
anywaysss
so um my gui is still not working-
he is being helpful, suggesting u changes to do, etc
the changes in question being removing plr parameter (didnt work, only made things worse) and to redo my script (afterwards i found there was a tiny isolate solution so i didnt even have to redo it all)
also if yall wanna keep replying maybe do it otherwhere... i still need help with my gui and yall flooded the chatt
** You are now Level 14! **
Gracie Abrams reference
;_;
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local usern = player.Name
local nickn = player.DisplayName
local gui = game:GetService("StarterGui").MenuGui.PlayerFrame
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(plr, voting)
print("hai")
if voting == true then
local i = unit:Clone()
i.Parent = gui
i.Name = usern
i.TextLabel.Text = nickn
i.Visible = true
else
gui:WaitForChild(usern):Destroy()
end
end)```
anyways this is the script now
and yes i did remove the plr parameter again and yes it didnt work 🙄
where u getting plr nd voting from
server
isnt it player
is this local script
?
yes
also where is ur pkayer
player variable
local plr = game.Players.LocalPlayer
no
same
plr is the loaded player to display its name and avatar
player is game:FindService("Players").LocalPlayer
plr is basically everyone pressing play so it clones it to display, like piggy
player is the player client itself
im so lost
??
what are u sayin
what i did is
i ran a remoteevent from a client to a server
then i put the info back to the client to display the name and avatar
what i did with this is basically i can load anyone's info apart from just loading player client info
findservice returns nil if service is not initialised
its :GetPlayers after that
wheres the error
... getservice doesnt make it work either
yea
show code
is this it
its a print proof error bc i print and print says its all fine
ok logic error
this is
actually no bc i did change startergui for playergui
StarterGui not playergui
bro
lemme recopypaste
ok
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local usern = player.Name
local nickn = player.DisplayName
local gui = player.PlayerGui
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(plr, voting)
print("hai")
if voting == true then
local i = unit:Clone()
i.Parent = gui
i.Name = usern
i.TextLabel.Text = nickn
i.Visible = true
else
gui:WaitForChild(usern):Destroy()
end
end)```
run this
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local usern = player.Name
local nickn = player.DisplayName
local gui = player.PlayerGui
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(voting)
if voting == true then
local i = unit:Clone()
i.Parent = gui
i.Name = usern
i.TextLabel.Text = nickn
i.Visible = true
else
gui:WaitForChild(usern):Destroy()
end
end)```
also show serverside
oh yes
onclientevent does not fire client
its a reference to which client needs firing
youre probably using voting as plr
there
what
lemme print to prove what you saying
nope its all well sorted out
plr = Daparty75 (me) voting = true
-- Server
event:FireClient(game.Players.closurebased, "Hello world!") -- 1st param is an indicator to which client should receive the signal
ok why take client as a param
if ur using
fireallclients
i dont know sir
youre not using the client arg either
im firing to all clients each player's info so they all have the player's info
so actually
i didnt use plr
my bad
it still doesnt work but still lemme share it to yall
.Name too
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local gui = player.PlayerGui
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(plr, voting)
print(plr, voting)
if voting == true then
local i = unit:Clone()
i.Parent = gui
i.Name = plr.Name
i.TextLabel.Text = plr.DisplayName
i.Visible = true
else
gui:WaitForChild(plr.Name):Destroy()
end
end)```
now i am actually using the parameter to load the info i want
what
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
wait
lol
local unit = game:GetService("ReplicatedStorage").PlayerUnit
local uic = unit.UICorner
local uis = unit.UIStroke
local img = unit.ImageLabel
local tex = unit.TextLabel
local gui = player:WaitForChild("PlayerGui")
game:GetService("ReplicatedStorage").PlayerIcon.OnClientEvent:Connect(function(plr, voting)
print(plr, voting)
if voting == true then
local i = unit:Clone()
i.Parent = gui
print(i.Parent)
i.Name = plr.Name
i.TextLabel.Text = plr.DisplayName
i.Visible = true
else
gui:WaitForChild(plr.Name):Destroy()
end
end)```
for instances that are generated during runtime you need to use waitforchild
OMG
if you dont, they are nil
not our fault tho
yall kidna led me the right way tho
it wont show it
and u was sayin we aint helpin
but all good
i should have smelled the explorer obv
no i was talking about the nest thingie not about all
if anything im the first one to believe people can help specially when those ai bros show up