Hello! I am currently trying to learn more about scripting, specifically Mouse, so I created a system that intends to place a part wherever the user clicks, along with a client-sided hologram to show where the part will be placed.
I am achieving this by sending a RemoteEvent from a LocalScript to a server Script as the LocalScript is needed to detect the player’s mouse inputs. However, the RemoteEvent is not launching and I don’t know why.
My LocalScript (located in StarterPlayer > StarterPlayerScripts):
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local hologram = Instance.new("Part")
hologram.Anchored = true
hologram.CanCollide = false
hologram.CanTouch = false
hologram.Transparency = 0.5
hologram.Parent = workspace
Mouse.TargetFilter = hologram
Mouse.Move:Connect(function()
hologram.Position = Mouse.Hit.p
end)
Mouse.Button1Down:Connect(function()
game:GetService("ReplicatedStorage").PlaceEvent:FireServer(Mouse.Hit.p)
end)
My Script (named “Handler”, located in a RemoteEvent located inside ReplicatedStorage):
script.Parent.OnServerEvent:Connect(function(player, value)
local hologram = Instance.new("Part")
hologram.Anchored = true
hologram.Parent = workspace
hologram.Position = value
end)
I have confirmed that everything in the LocalScript works by adding print() throughout the script. The problem seems to be located in the server Script.
If anyone knows what I’m doing wrong, please let me know. Any help is appreciated!