#"expected function call arguments after '('"?!?!?

1 messages · Page 1 of 1 (latest)

worldly vigil
#

here's my script:

\lua game.ReplicatedStorage.hat.OnServerEvent:Connect(function(plr)
if plr.leaderstats.Hat.Value < 5 then
plr.leaderstats.Hat.Value = plr.leaderstats.Hat.Value + 1
local char = plr.Character or plr.CharacterAdded:wait()
local hum = char.Humanoid
local Replicated = game:GetService("ReplicatedStorage")
local hatone = Replicated:WaitForChild("tophat"):Clone()
local hattwo = Replicated:WaitForChild("tophat"):Clone()
local hatthree = Replicated:WaitForChild("tophat"):Clone()
local hatfour = Replicated:WaitForChild("tophat"):Clone()
local hatfive = Replicated:WaitForChild("tophat"):Clone()
if plr.leaderstats.Hat.Value == 1 then
hatone.Parent = char
end
if plr.leaderstats.Hat.Value == 2 then
hattwo.Parent = char
char.hatone:Destroy
end
if plr.leaderstats.Hat.Value == 3 then
hatthree.Parent = char
char.hattwo:Destroy
end
if plr.leaderstats.Hat.Value == 4 then
hatfour.Parent = char
char.hatthree:Destroy
end
if plr.leaderstats.Hat.Value == 5 then
hatfive.Parent = char
char.hatfour:Destroy
end
end
end)\

all of the destroy lines are highlighted with this error and I am very, very confused.

#

"expected function call arguments after '('"?!?!?

hollow talon
#

did you add the "\" and "/" only here or are those actually in the script

worldly vigil
#

?

hollow talon
#

also there are a few issues, you can't just do ":Destroy", you're missing the "()"

worldly vigil
#

I tried to do

#

\lua

pearl mantle
hollow talon
#
some code
worldly vigil
#

OHH I am missing the ()

hollow talon
#

yeah

#

also here it's :Wait(), case sensitive

worldly vigil
#

I feel silly

#

ohh

pearl mantle
#

Do you by any chance not just let it autofill by pressing tab?

worldly vigil
#

IT WORKS NPOW

#

THANK YOU

pearl mantle
#

Helps with not caring for such things

worldly vigil
#

it create's the folder upon the loading of the game

#

the leaderstats one

pearl mantle
worldly vigil
#

I mean

hollow talon
#

oh yeah i got it

worldly vigil
#

the hat isn't yet parent of the

#

ye

#

well thank youuu!!!

crimson bloomBOT
#

studio** You are now Level 12! **studio

worldly vigil
#

yall are quick widdit

hollow talon
#

its because lua is a dynamic language, you can use ":" to make some typed variables
like:
local folder: Folder = someweirdplace
and now folder will have all the parameters of a folder

crimson bloomBOT
#

studio** You are now Level 3! **studio

worldly vigil
#

o

hollow talon
#

or if you don't want to create a variable, "::"
like:

local hattwo = Replicated:WaitForChild("tophat"):Clone() :: Part

now hattwo will have the properties of a part

worldly vigil
#

neat

rich dagger
#

ur tuff asl

hollow talon
rich dagger
hollow talon