Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

10 comments

0

line 3

0

Consider using GetPlayerFromCharacter(), it has a reason to be used here

0

where do i put that then

0

Line 2: if game.Players:GetPlayerFromCharacter(hit.Parent) then

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].

0

FirClient OmegaLul

0

omg im dum lol

0

wait, thats not wut is says in my script tho

0

You spelled "Fire" wrong.

0

well its not wrong in my actuall script tho

1 answer

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)

3 comments

0

the comma doesnt work on line 5

0

You forgot a bracket, plus it should be "plr" not "plr.Name"

0

where does the bracket go?

This discussion is preserved as it was. New answers, comments, and votes are closed.