I'm trying to make when ever I press 'F' , there will be a brick spawned to the mouse position (vector 3)
Using Local Script , I created this
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "f" then local Part = Instance.new("Part",game.Workspace) Part.Position = Mouse.Hit.p end end)
it works absolutely perfect. Here's the problem , I want my game to be Filter Enabled. So now, when I press 'F' , the part would be created in workspace but not at my mouse position. I tried using the 'RemoteEvent' and 'RemoteFunction'. But it wouldn't work :(
How do I get a 'Vector 3' value to my Server script?
The Solution
Use Remote Event.
Local Script -
local Player = Game.players.LocalPlayers local Mouse = Player:GetMouse() local PositionEvent = script.Parent:WaitForChild("PositionEvent") PositionEvent:FireServer(Mouse.hit.p) ------// Sending the Mouse.hit.p to ServerScript
Server Script -
script.PositionEvent.OnServerEvent:connect(function(plr,Pos) ------// Plr is Player and the Pos is the recieved value from localscript. Part.Position = Pos end)