Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Please help me why this script dosent works? There is a string value that gets somehow the plr name. [closed]

Asked by
hvcu 3
6 years ago
    local green = game.Workspace.green:GetChildren()

    function onClicked(plr) -- On click get player
        if green.PLRNAME == plr.Name.Value then
        script.Parent.Parent:Destroy()
    end
    end


    script.Parent.ClickDetector.MouseClick:Connect(onClicked)
0
can you explain this more clearly? what is green? magentacrasyguy -7 — 6y
0
green is a door where the string value that gets the player is. hvcu 3 — 6y

Closed as Too Broad by User#24403, ee0w, TheluaBanana, and evaera

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

ok so what im guessing is either

local green = game.Workspace.green -- i altered this part a bit

function onClicked(plr) -- On click get player
    if green.PLRNAME == plr.Name.Value then
    script.Parent.Parent:Destroy()
end
end


script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- i also altered this part
    onClicked(plr)
end)

or that

local green = game.Workspace.green -- i altered this part a bit

function onClicked(plr) -- On click get player
    if green.PLRNAME == plr.Name then -- i also altered this part a bit
    script.Parent.Parent:Destroy()
end
end


script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- i also also altered this part
    onClicked(plr)
end)

i apologize if this dusnt work ur question is also too broad btw

0
there is something wrong. The local green = game.Workspace.green:GetChildren() is very correct if you change it the script will fail. hvcu 3 — 6y
0
but it also fails anyways if u dont change it right? Logistically that would not prove its wrong it would simply not confirm that its correct TheluaBanana 946 — 6y
0
no. the problem is: The string is placed in a part. green is a model, GREEN is the acctual part. But after player goes in the door, the GREEN changes to player name, also the PLRNAME hvcu 3 — 6y
0
im certain GetChildren() is very wrong a simple way to test this theory is to just define PLRNAME by itself. Now after u said that, i am unsure what u r doing TheluaBanana 946 — 6y
View all comments (57 more)
0
thats why i put get child hvcu 3 — 6y
0
which line TheluaBanana 946 — 6y
0
also i have tested the probability of GetChildren() by defining a part in the workspace via TheluaBanana 946 — 6y
0
local part = workspace:GetChildren().Part; print(part) TheluaBanana 946 — 6y
0
which showed no success TheluaBanana 946 — 6y
0
so it is technically proven TheluaBanana 946 — 6y
0
also u do realize im spending a lot of time trying to correct u on this simple point TheluaBanana 946 — 6y
0
oh look at the model hvcu 3 — 6y
0
no offense meant but ur point is practically like trying to say that the earth is flat; unless if u do believe it is which in that case i have no words TheluaBanana 946 — 6y
0
green(model) - GREEN (brick) - PLRNAME (Stringvalue) and The script that gets the name. hvcu 3 — 6y
0
@hvcu i have tested that too and it also yielded the same results TheluaBanana 946 — 6y
0
so if u dont get this problem fixed we will not get answer TheluaBanana 946 — 6y
0
also i still dont understand ur purpose of this contraption TheluaBanana 946 — 6y
0
oh looks like i have to test. hvcu 3 — 6y
0
also where is the script located at? TheluaBanana 946 — 6y
0
is located in a brick that is located in a model hvcu 3 — 6y
0
how i can get a model's part without the exact name because THE NAME OF MODEL CHILD CHANGES maybe this will be the answer hvcu 3 — 6y
0
u could put the script in the model's part TheluaBanana 946 — 6y
0
it also gives me no error hvcu 3 — 6y
0
also that dusnt change a thing cus ur script also dusnt address that issue. Also also, u only need the name of the model before it changes. TheluaBanana 946 — 6y
0
@hvcu yes it does not yield error it yields "nil"  if u attempt to print the part's name, which is basically means the script is unable to locate what u want TheluaBanana 946 — 6y
0
if i got backup from the community would u belive me? TheluaBanana 946 — 6y
0
dude im trying to help u here TheluaBanana 946 — 6y
0
wait a minute, isnt PLRNAME a string value and it should be PLRNAME.Value? hvcu 3 — 6y
0
correct that was what i said TheluaBanana 946 — 6y
0
well, not exactly, but its kinda TheluaBanana 946 — 6y
0
i made it more clear, now GREEN will remain GREEN and another thing will change name but why it still DOSENT WORK??? hvcu 3 — 6y
0
also i cant think of an idea o what ur gonna use this for TheluaBanana 946 — 6y
0
because green:GetChildren y wont u believe me dude TheluaBanana 946 — 6y
0
umm i am making a tycoon. Im making this for the new things to buy, because other players can click on it. Thats why i am trying to make. hvcu 3 — 6y
0
uhhhh u know that is a completely wrong strategy to do thing right TheluaBanana 946 — 6y
0
ok. . . hvcu 3 — 6y
0
this can be resolved very easily. TheluaBanana 946 — 6y
0
ok then how hvcu 3 — 6y
0
also im certain it will work if u dont use :GetChildren() TheluaBanana 946 — 6y
0
ok ill edit my answer gimme a minute TheluaBanana 946 — 6y
0
i removed it but still dosent work... hvcu 3 — 6y
0
cus there is more then one thing wrong here TheluaBanana 946 — 6y
0
im gonna test hvcu 3 — 6y
0
also have u not heard of the scientific method? TheluaBanana 946 — 6y
0
scientific method ... no hvcu 3 — 6y
0
ok that explains everything TheluaBanana 946 — 6y
0
it works but i think it still can be clicked by more persons... hvcu 3 — 6y
0
well is it disabled? TheluaBanana 946 — 6y
0
ok look very easy: make a whitelisted table; anyone thats whitelisted is capable of buying stuff TheluaBanana 946 — 6y
0
and set a limit to said table TheluaBanana 946 — 6y
0
it was but yestarday i was testing with my friend and when he clicked it worked for him (but i was owning the tycoon) hvcu 3 — 6y
0
ok look team create me a baseplate ill show u de wae TheluaBanana 946 — 6y
0
cuz your the best im 80% sure that i fixed it thanks hvcu 3 — 6y
0
its also a possibility ur friend sabotaged the script before he left to prevent u from learning the code scene as its ur game; leaving u to beleive false assumptions ultimately beleiveing GetChildren() which is actually just a table returning all the things in there TheluaBanana 946 — 6y
0
and @hvcu at this said time im actually probably am TheluaBanana 946 — 6y
0
this cant be real because 1 he dosent even know how to change roblox settings 2 he is my best friend . One more thing: Can i do if ... then and again if ... then? hvcu 3 — 6y
0
no u do for i, v in pairs(table) do TheluaBanana 946 — 6y
0
thanks hvcu 3 — 6y
0
gd it ill just give u an example of a table ill edit the answer, u know what nvm im guessin what i just said worked? TheluaBanana 946 — 6y
0
worked!!!!! hvcu 3 — 6y
0
xd ok TheluaBanana 946 — 6y
Ad
Log in to vote
0
Answered by
hvcu 3
6 years ago
Edited 6 years ago

This was succesfully fixed:


local green = game.Workspace.green function onClicked(plr) -- On click get player if green.GREEN.PLRNAME.Value == plr.Name and plr.leaderstats.Money.Value >=50 and plr.leaderstats.Machines.Value == 5 then script.Parent.Parent:Destroy() end end script.Parent.ClickDetector.MouseClick:Connect(function(plr) onClicked(plr) end)
  • Worked for me!!!
0
: ) hvcu 3 — 6y