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

(?) RemoteEvent is not passing on variable correctly

Title, pretty simple:

-- LocalScript

game.ReplicatedStorage.RemoteEvent:FireServer(cframe)

And the other script,


-- Script controlling RemoteEvent

part.CFrame = cframe

But of course Roblox in the Output is like 'CFrame is not vaild member of Player'

This should be straightfoward, does anyone have a fix? Thanks.

3 comments

0

We need more information on the scripts so we will understand.

0

Well the studios rules say I can't leak too much information on scripts, the only thing I can say is that it is for an FPS.

0

without your script and your problem, we cant do anything about it

1 answer

✓ Accepted answer

I think I got this. Does the .OnServerEvent function look like this?

remote.OnServerEvent:Connect(function(cframe)

if yes, the problem is the FIRST parameter of .OnServerEvent is the player that fired it. So you're setting the part's CFrame to the player, wich gives an error. To fix it, try this:

remote.OnServerEvent:Connect(function(player,cframe) -- first is the player, second is the argument passed by :FireServer()

I hope this helped!

2 comments

0

Great, this fixed the issue, thank you so much!

0

Glad I could help!

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