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

Attempt to compare two userdata values?

--local event = game.ReplicatedStorage.Remote.Mow
local event = script.Parent:WaitForChild("Events").Mow

event.OnServerEvent:Connect(function(plr, target)
	if target.Size > 0.2 then
		target.Size = target.Size - Vector3.new(0,0.1,0)
		target.CFrame = CFrame.new(target.Position - Vector3.new(0,0.05,0))
	else
		print(target.Size)
	end


end)

im bamboozled

1 answer

Hi dark,

The reason it's giving you that error is because the SIze is a Vector3 value, and you're comparing it to a Number value. So, I recommend to compare it to the Vector3 value.

####Something like this:

--local event = game.ReplicatedStorage.Remote.Mow
local event = script.Parent:WaitForChild("Events").Mow

event.OnServerEvent:Connect(function(plr, target)
    if target.Size > Vector3.new(0, 0.2, 0) then
        target.Size = target.Size - Vector3.new(0,0.1,0)
        target.CFrame = CFrame.new(target.Position - Vector3.new(0,0.05,0))
    else
        print(target.Size)
    end


end)

###Or, if you wanna compare only the y axis of the Size, then this is how you'd do it:

--local event = game.ReplicatedStorage.Remote.Mow
local event = script.Parent:WaitForChild("Events").Mow

event.OnServerEvent:Connect(function(plr, target)
    if target.Size.Y > 0.2 then
        target.Size = target.Size - Vector3.new(0,0.1,0)
        target.CFrame = CFrame.new(target.Position - Vector3.new(0,0.05,0))
    else
        print(target.Size)
    end


end)

##Hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

2 comments

0

KING LONE, LONG TImE NO SEE DUDE :D

0

Yeah, it's been a while. How's it going?

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