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

[Filtering Enabled] How is CFrame Userdata?

Asked by 9 years ago

local pos = CFrame.new(head.CFrame.p,((look).p)) * CFrame.Angles(0,math.rad(-90),0) print(pos)

.RemoteEvent.Script:4: bad argument #3 to 'CFrame' (CFrame expected, got userdata)

.RemoteEvent.Script', Line 4 00:53:06.256 - Stack End 3.27510118, 1.90560794, 9.53083324, 0.430322081, -8.72344608e-005, -0.90267539, 0.000202718991, 1, -8.86112884e-012, 0.90267545, -0.000182989446, 0.430322051

0
Your question is extremely broad and I had to answer based on an assumption. To get the most accurate answers please elaborate on your problem. Goulstem 8144 — 9y

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Please put your code in appropriate Lua code block next time


Because your title states that you have FilteringEnabled on and the error message states it's erroring from a RemoteEvent, then i'm going to make an assumption.

The only sole variable usage I see there is when you're using 'look' in your CFrame constructor, while setting the CFrame.. So i'm assuming that you're trying to send a CFrame through the FireServer function, but are ending up with a userdata?

Forgive me if i'm wrong, but you didn't supply much details for me to make my answer on. If I had to guess then I would say that you're using look as the parameter for the CFrame you're sending.. and look is your only parameter in the event. If this is the case then you need to change that.


OnServerEvent events take in a defualt parameter before any other custom ones - the player that fired the server. This will ALWAYS be the first parameter's value for the event.. so if you only have look, then it's always going to end up being a player instance - or userdata, hence the error.


So to fix? You need to make look your SECOND parameter in the event.


RemoteEvent.OnServerEvent:connect(function(player,look)
    --code
end

Now, player will be the player and look will be your sent data(:

Ad

Answer this question