Very confused with values

Im trying to set the amount of time it would take for the “rocks” to disappear.
The values its wanting:

["GroundSlamEffect"] = function(char,part,ZSize,SC,Num,Time)

The Values I set it to:

char,stand:WaitForChild("Torso"),4.5,1.7,30,1.5

And what comes out:

CheeseyMine Torso 4.5 1.7 30 nil

The nil is the time (1.5), im sorry if its confusing but i tried my best to explain it lol

2 Likes

We need to see the contents of the function you’re passing these values into. Syntax is correct on the surface: you’re sending six values in and you should be getting six out.

1 Like

is this what your talking about

["GroundSlamEffect"] = function(char,part,ZSize,SC,Num,Time)
		local TS = game:GetService("TweenService")
		task.spawn(function()
			local posi = CFrame.new(part.Position)
			local cfangle = posi * CFrame.Angles(0,math.rad(math.random(-360,360)),0)
			for v = 1,Num do
				local Thung = false
				local partclone = script.Part:Clone()
				partclone.Anchored = true
				partclone.CFrame = cfangle * CFrame.Angles(0,math.rad(360/Num*v),0)
				partclone.CFrame = partclone.CFrame * CFrame.new(0,-SC/2,0)
				local cf1 =  partclone.CFrame * CFrame.new(0,2,-10)
				local cf2 = partclone.CFrame * CFrame.new(0,2,-ZSize) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
				print(char,part,ZSize,SC,Num,Time)
				game.Debris:AddItem(partclone,Time+1)
				local partonray,findrayatend = workspace:FindPartOnRayWithWhitelist(Ray.new(cf2.p+ Vector3.new(0,10,0),CFrame.new(cf2.p).UpVector*-20),{workspace})
				if partonray then
					if partonray.Parent ~= nil and partonray.Parent:IsA("Model") then
						local partpare = partonray.Parent
						if partpare:FindFirstChild("Humanoid") then
							partclone:Destroy()
							Thung = true
						end
					end
					if Thung == false then
						local cf3 = nil
						partclone.Color = partonray.Color
						partclone.Material = partonray.Material
						cf3 = CFrame.new(findrayatend) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
						partclone.Parent = workspace
						if part == nil then
							TS:Create(partclone,TweenInfo.new(.27,Enum.EasingStyle.Exponential,Enum.EasingDirection.In,0,false,0),
								{
									CFrame = cf3}):Play()
							TS:Create(partclone.Mesh,TweenInfo.new(.27,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut,0,false,0),
								{
									Scale = Vector3.new(SC,SC,SC)* (math.random(50,100)/100)
								}
							):Play()
						else
							partclone.CFrame = cf3
							partclone.Mesh.Scale = Vector3.new(SC,SC,SC)* (math.random(50,100)/100)
						end
						if part == nil then
							wait(.25)
						end
						local weld = nil
						if partonray:IsDescendantOf(workspace)== false and partonray.Anchored == false then
							weld = Instance.new("Weld",partclone)
							weld.C0 = partonray.CFrame:inverse()*partclone.CFrame
							weld.Part0 = partonray
							weld.Part1= partclone
							partclone.Anchored = false
						end
						delay(Time,function()
							if partclone and partclone:FindFirstChild("Mesh")==nil then
								partclone:Destroy()
								return
							end
							TS:Create(partclone.Mesh,TweenInfo.new(.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),
								{
									Scale = Vector3.new(0,0,0)
								}
							):Play()
							if weld ==nil then
								TS:Create(partclone,TweenInfo.new(.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),
									{
										CFrame = CFrame.new(partclone.CFrame.p)*CFrame.new(0,-partclone.Size.X,0)
									}
								):play()
							end
							game.Debris:AddItem(partclone,1)
						end)
					end
				else
					partclone:Destroy()
				end
			end
		end)
	end,

How are you calling this particular function? Nothing should be wrong with this, so I am thinking it’s how you’re calling the function rather than what is inside of it.

1 Like

im not sure why its not working.

EffectEvent:FireAllClients("MainEffects","GroundSlamEffect",char,stand:WaitForChild("Torso"),4.5,1.7,30,1.5)

this is whats callin it

1 Like

You’re passing in seven values to a function that takes six arguments.

You’re doing this:

-- This is your function
["GroundSlamEffect"] = function(char, part, ZSize, SC, Num, Time)

-- You are sending these values
"MainEffects", "GroundSlamEffect", char, stand:WaitForChild("Torso"), 4.5, 1.7, 30, 1.5

Notice how you are sending in "MainEffects" as your first argument instead of "GroundSlamEffect". Naturally, you’re not getting Time back because there are only six arguments in your function.

Add another argument mainevent to your function before char.

Where is “Time” defined in this script?

["GroundSlamEffect"] = function(char,part,ZSize,SC,Num,Time)
		local TS = game:GetService("TweenService")
		task.spawn(function()
			local posi = CFrame.new(part.Position)
			local cfangle = posi * CFrame.Angles(0,math.rad(math.random(-360,360)),0)
			for v = 1,Num do
				local Thung = false
				local partclone = script.Part:Clone()
				partclone.Anchored = true
				partclone.CFrame = cfangle * CFrame.Angles(0,math.rad(360/Num*v),0)
				partclone.CFrame = partclone.CFrame * CFrame.new(0,-SC/2,0)
				local cf1 =  partclone.CFrame * CFrame.new(0,2,-10)
				local cf2 = partclone.CFrame * CFrame.new(0,2,-ZSize) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
				print(char,part,ZSize,SC,Num,Time)
				game.Debris:AddItem(partclone,Time+1)
				local partonray,findrayatend = workspace:FindPartOnRayWithWhitelist(Ray.new(cf2.p+ Vector3.new(0,10,0),CFrame.new(cf2.p).UpVector*-20),{workspace})
				if partonray then
					if partonray.Parent ~= nil and partonray.Parent:IsA("Model") then
						local partpare = partonray.Parent
						if partpare:FindFirstChild("Humanoid") then
							partclone:Destroy()
							Thung = true
						end
					end
					if Thung == false then
						local cf3 = nil
						partclone.Color = partonray.Color
						partclone.Material = partonray.Material
						cf3 = CFrame.new(findrayatend) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
						partclone.Parent = workspace
						if part == nil then
							TS:Create(partclone,TweenInfo.new(.27,Enum.EasingStyle.Exponential,Enum.EasingDirection.In,0,false,0),
								{
									CFrame = cf3}):Play()
							TS:Create(partclone.Mesh,TweenInfo.new(.27,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut,0,false,0),
								{
									Scale = Vector3.new(SC,SC,SC)* (math.random(50,100)/100)
								}
							):Play()
						else
							partclone.CFrame = cf3
							partclone.Mesh.Scale = Vector3.new(SC,SC,SC)* (math.random(50,100)/100)
						end
						if part == nil then
							wait(.25)
						end
						local weld = nil
						if partonray:IsDescendantOf(workspace)== false and partonray.Anchored == false then
							weld = Instance.new("Weld",partclone)
							weld.C0 = partonray.CFrame:inverse()*partclone.CFrame
							weld.Part0 = partonray
							weld.Part1= partclone
							partclone.Anchored = false
						end
						delay(Time,function()
							if partclone and partclone:FindFirstChild("Mesh")==nil then
								partclone:Destroy()
								return
							end
							TS:Create(partclone.Mesh,TweenInfo.new(.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),
								{
									Scale = Vector3.new(0,0,0)
								}
							):Play()
							if weld ==nil then
								TS:Create(partclone,TweenInfo.new(.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),
									{
										CFrame = CFrame.new(partclone.CFrame.p)*CFrame.new(0,-partclone.Size.X,0)
									}
								):play()
							end
							game.Debris:AddItem(partclone,1)
						end)
					end
				else
					partclone:Destroy()
				end
			end
		end)
	end,
1 Like

It’s used in the delay statements that are roughly in the middle of the code.

1 Like

wait lemme explain to you real quick, the maineffects and groundslameffects are not going to the groundslameffect values. Its for something else

Can you show me the entire script? (atleast the part that shows the .OnClientEvent)

EffectEvent.OnClientEvent:Connect(function(Table, Func, Request1, Request2, Request3, Request4, Request5)
	if script:FindFirstChild(Table) then
		local Module = require(script:WaitForChild(Table))
		if Module[Func] then
			Module[Func](Request1, Request2, Request3, Request4, Request5)
		end
	end
end)
1 Like

What?

You’re still passing in seven values to a function that takes six arguments. That is why Time is nil. It doesn’t quit matter what you’re using those values for. FireAllClients doesn’t have a native Player argument, so the arguments you set are the arguments this function expects.

1 Like

wait i might of just figured out my own issue. omg

1 Like

After seeing your code, this may be of interest to you. It would simplify having to define n Request for every argument you want to use in your function.

https://www.lua.org/pil/5.2.html

2 Likes

You are missing another “Request” in the script, put “Request6” in both of the lines where you are passing the values

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.