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

matching name must match int value name to move to work space.. HELP!!!??!

Asked by 8 years ago

so guys, I have a save script, it works perfect.. vars and all are perfect but, in my replicated storage, i made a section where characters are. The characters name is why I made the script.

so far this is what i am trying to do, 2 scripts..

1local a = game.Players.LocalPlayer.SaveMonsters
2if script.Parent.Name == a:WaitForChild(script.Parent.Name) then
3    local b = a:WaitForChild(script.Parent.Name)
4    c = script.Parent:Clone(a.Value)
5    c.Parent = game.Workspace
6end

this is for the the item to match its int name...

then comes this to add value to my save script value

01while true do
02    wait()
03    if script.Parent.Parent == game.Workspace then
04        if script.Parent.Name == game.Players.LocalPlayer.SaveMonsters:WaitForChild(script.Parent.Name) then
05            a = game.Players.LocalPlayer.SaveMonsters:WaitForChild(script.Parent.Name)
06            a.Value = a.Value + 1
07            script:Destroy()
08        end
09    end
10    if script.Parent.Parent == game.Workspace.Monsters then
11        if script.Parent.Name == game.Players.LocalPlayer.SaveMonsters:WaitForChild(script.Parent.Name) then
12            a = game.Players.LocalPlayer.SaveMonsters:WaitForChild(script.Parent.Name)
13            a.Value = a.Value + 1
14            script:Destroy()
15        end
16    end
17end

with this I am suppose to make a monsters name from the replicated storage math its name found in the save script then clone the monster and place it in workspace. how would I do this? this is really hard i would LOVE some feedback, please help!

0
Why is your second script repeating the same thing except the second portion has `game.Workspace.Monsters` from the previous `game.Workspace`? SocialENTRcoRSE 21 — 8y
1
shows if its parent is .Monsters greatneil80 2647 — 8y
0
this post is a train wreck greatneil80 2647 — 4y
0
agreed raid6n 2196 — 4y
0
lmao the title HELP?!?!??!? raid6n 2196 — 4y

2 answers

Log in to vote
4
Answered by 8 years ago

New script that is not working:

01function addMonstersToGameByPlayer (player, playerMonsters)
02    local tableOfMonstersRetrieved = playerMonsters:GetChildren()
03    for _, v in pairs(tableOfMonstersRetrieved) do
04        local potentialMatch = game.ReplicatedStorage.CharactersLevelOne:FindFirstChild(v.Name)
05        if potentialMatch then
06            for i = 1, v.Value do
07                local c = potentialMatch:Clone()
08                c.Parent = game.Workspace
09            end
10        end
11    end
12end
4
1 year ago xDDD, Man, such a nub i was back then greatneil80 2647 — 6y
0
Lol User#24403 69 — 6y
0
Bruh my message from a year ago saying 1 year ago I was such a nub, well a year ago I was as nooby as the year before hAHha yes pls upvote this comment now, also enjoy knowing that i somehow accepted my own post greatneil80 2647 — 5y
1
dumb post!!!!! royaltoe 5144 — 5y
View all comments (7 more)
0
poop raid6n 2196 — 4y
0
yes greatneil80 2647 — 4y
0
bruh that comment is from a year ago, WAIT THIS POST IS FROM 3 YEARS AGO greatneil80 2647 — 4y
0
LOL sean_thecoolman 189 — 4y
0
this entire post is sh's greatest meme greatneil80 2647 — 3y
0
I know this is over a year old what you said about accepting your own post. You can't accept your own post, unless someone else who has community moderator accepts it for you, otherwise it may have been a glitch which is uncommon. JesseSong 3916 — 3y
0
No, I'm pretty sure someone else accepted my own post which is amazing lmao greatneil80 2647 — 3y
Ad
Log in to vote
1
Answered by 8 years ago

I don't necessarily know how to fix your issue but doesn't this look like it needs to be fixed as shown?

1local a = game.Players.LocalPlayer.SaveMonsters
2if script.Parent.Name == a:WaitForChild(script.Parent.Name) then
3    local b = a:WaitForChild(script.Parent.Name)
4    local c = script.Parent:Clone(a.Value)-- if you haven't defined the c part shouldn't you define it with a local first as shown?
5    c.Parent = game.Workspace
6end
1
ik ik i c the problem, i fixed it.... greatneil80 2647 — 8y

Answer this question