Hello, I was working on one of the projects right now then when I clicked to spawn a block it didn’t work BUT it prints everything on the script successfully when I clicked on that printed text then go back to clientside it worked what is going on??
my local script :
local CanPlace = true
local Domino
local Mouse = game.Players.LocalPlayer:GetMouse()
local Rotation = 0
local UIS = game:GetService("UserInputService")
local Reload = false
game:GetService("RunService").RenderStepped:Connect(function()
if CanPlace == true then
Domino = game.Workspace.Folder:FindFirstChild("Domino")
if Domino then
Mouse.TargetFilter = game.Workspace.Folder
game.Workspace.Folder.Domino:SetPrimaryPartCFrame(CFrame.new(game.Players.LocalPlayer:GetMouse().Hit.X, game.Players.LocalPlayer:GetMouse().Hit.Y + 0.4, game.Players.LocalPlayer:GetMouse().Hit.Z))
game.Workspace.Folder.Domino:SetPrimaryPartCFrame(game.Workspace.Folder.Domino:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(4.7,0,Rotation))
else
local new = game.ReplicatedStorage.Domino:Clone()
new.Parent = game.Workspace.Folder
Domino = new
Mouse.TargetFilter = game.Workspace.Folder
end
end
end)
UIS.InputBegan:Connect(function(keycode)
if keycode.KeyCode == Enum.KeyCode.R then
Rotation = Rotation + math.pi/1.2
end
end)
Mouse.Button1Up:Connect(function()
if CanPlace == true then
print("fired server")
local cframe = Domino.PrimaryPart.CFrame
game.ReplicatedStorage.Place:FireServer(cframe)
end
end)
script.Parent.MouseButton1Up:Connect(function()
if Reload == true then
script.Parent.Text = "Play"
game.ReplicatedStorage.Reload:FireServer()
CanPlace = true
Reload = false
else
script.Parent.Text = "Reload"
game.ReplicatedStorage.Play:FireServer()
CanPlace = false
Reload = true
end
end)
my script :
game.ReplicatedStorage.Place.OnServerEvent:Connect(function(player, cframe)
print("place got fired")
local new = game.ReplicatedStorage.Domino:Clone()
for i,v in ipairs(new:GetChildren()) do
v.CanCollide = true
end
new.Parent = game.Workspace
new.PrimaryPart.CFrame = cframe
print(cframe)
end)
What should I do?? (sorry if I had bad grammar)
Edit: Now it even doesn’t spawn when I go back to clientside