I want to make it so that when the player presses a button it will Use the FireServer() Event and go to a ServerScript. This Server Script will have the whole parts of Creating the part. But this will Play in Studio but not in game. I've tried Getting a RemoteEvent And giving the Server Script a FireClient() and then linking it to A LocalScript But that wouldn't work. Any Solutions?
Local script
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local en = true
local ben = true
local Has = true
local char = Player.Character
local hum = Player.Character.Humanoid
local root = Player.Character.HumanoidRootPart
local UpperTorso = char.UpperTorso
script.Parent.Equipped:Connect(function()
Has = true
end)
script.Parent.Unequipped:Connect(function()
Has = false
end)
local holdingUKey = false
UIS.InputBegan:Connect(function(inputObject)
if(inputObject.KeyCode==Enum.KeyCode.Q)then
bp2 = Instance.new("BodyPosition")
bp2.Parent = char.UpperTorso
bp2.P = 100000
bp2.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bp2.Position = char.UpperTorso.Position
wait(2)
en = true
end
end)
UIS.InputEnded:Connect(function(inputObject)
if(inputObject.KeyCode==Enum.KeyCode.Q)then
if not Has then return end
holdingUKey = false
hum.AutoRotate = true
bp2:Destroy()
script.Parent.RemoteEvent:FireServer()
end
end)
Server Script
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
player = game:WaitForChild("Players")
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local en = true
local ben = true
local Has = true
local char = Player.Character
local hum = Player.Character.Humanoid
local root = Player.Character.HumanoidRootPart
local UpperTorso = char.UpperTorso
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
local Part = Instance.new("Part")
Part.Parent = workspace
Part.CFrame = root.CFrame * CFrame.new(0,3,-5)
Part.Anchored = true
Part.CanCollide = false
end)

4 comments
LocalPlayer is nil on the server, UserInputService is client-side only, and you cannot get the Mouse from the server either. OnServerEvent passes the Player as a parameter, so use that instead.
1 -- script.Parent.RemoteEvent.OnServerEvent:connect(function(plr) -- The first argument in an OnServerEvent is the player who fired the event as incapaz said
Is passing down the plr agrument all i have to do?
Try using a RemoteFunction.