-
What do you want to achieve? Script that places a model or part.
-
What is the issue? It places the part
-
What solutions have you tried so far? Tried to make a debounce but didnt work.
userInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if placingStructure == true then
if goodToPlace == true then
local structureCFrame = clientStructure.CFrame
placedStructure = placeStructure:InvokeServer(clientStructure.Name, structureCFrame)
if placedStructure == true then
placingStructure = false
clientStructure:Destroy()
wait(0.5)
structureFrame.Visible = true
structureFrame.Parent.Visible = true
end
end
end
end
end)
The reason is that the Event gets fired when the mouse gets: Press and Released
Any way to make this not happen?
Check if input.UserInputState is Enum.UserInputState.Begin
`userInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if input.UserInputState == Enum.UserInputState.Begin then
if placingStructure == true then
if goodToPlace == true then
local structureCFrame = clientStructure.CFrame
placedStructure = placeStructure:InvokeServer(clientStructure.Name, structureCFrame)
if placedStructure == true then
placingStructure = false
clientStructure:Destroy()
wait(0.5)
structureFrame.Visible = true
structureFrame.Parent.Visible = true
end
end
end
end
end
end)`
Still does it so is this correct?
I just noticed you didn’t have to do that because its UserInputService
placeStructure.OnServerInvoke = function(player,structureName,structureCFrame)
local crafted
local realStructure = structures:FindFirstChild(structureName):Clone()
if realStructure then
realStructure.CFrame = structureCFrame
realStructure.Parent = game.Workspace
crafted = true
else
crafted = false
end
return crafted
end
Thats the remote function if you can find anything there
Hey
`placeStructure.OnServerInvoke = function(player,structureName,structureCFrame)
local crafted
local realStructure = structures:FindFirstChild(structureName):Clone()
if realStructure then
realStructure.CFrame = structureCFrame
realStructure.Parent = game.Workspace
crafted = true
else
crafted = false
end
return crafted
end`