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

Why does it say expected parsing got "," on line 4?

Asked by 4 years ago
Edited 4 years ago
script.Parent.Touched:Connect(function(hit)
    if hit.Name == "HumanoidRootPart" then
        if game:GetService("Players")(hit.Parent.Name).leaderstats.Rebirths >= 10 then
            game:GetService("ReplicatedStorage").checkData:FirClient(game:GetService("Players")(hit.Parent.Name), Portal1)
        end
    end
end)

0
line 3 xTheodxre 16 — 4y
0
Consider using GetPlayerFromCharacter(), it has a reason to be used here DeceptiveCaster 3761 — 4y
0
where do i put that then xTheodxre 16 — 4y
0
Line 2: if game.Players:GetPlayerFromCharacter(hit.Parent) then DeceptiveCaster 3761 — 4y
View all comments (6 more)
0
Indexing a variable should also be done using square brackets instead of parenthesis, so that Lua assumes that you're treating the child as a member of a dictionary. An example of this is game.Players[hit.Parent.Name]. DeceptiveCaster 3761 — 4y
0
FirClient OmegaLul Fifkee 2017 — 4y
0
omg im dum lol xTheodxre 16 — 4y
0
wait, thats not wut is says in my script tho xTheodxre 16 — 4y
0
You spelled "Fire" wrong. MaximussDev 86 — 4y
0
well its not wrong in my actuall script tho xTheodxre 16 — 4y

1 answer

Log in to vote
0
Answered by
NotedAPI 810 Moderation Voter
4 years ago
Edited 4 years ago

I've revamped your script to hopefully get it working to your liking.

script.Parent.Touched:Connect(function(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent) or game.Players:GetPlayerFromCharacter(hit.Parent.Parent)

       if plr.leaderstats.Rebirths.Value >= 10 then
           game:GetService("ReplicatedStorage").checkData:FireClient(plr.Name), Portal1)
    end
end)

0
the comma doesnt work on line 5 xTheodxre 16 — 4y
0
You forgot a bracket, plus it should be "plr" not "plr.Name" MaximussDev 86 — 4y
0
where does the bracket go? xTheodxre 16 — 4y
Ad

Answer this question