generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Placement System

Previous Thread :: Next Thread 
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 05:19 AM
Hey, I am working on a placement system and I have an issue.

It works and all, but when I try to place on the Front and Left surfaces, it does not detect the placement there.

gyazo com/71d6fd7b597acfefd4be86b832c7b6fe

Here is the round function:

function round(step,number)
return math.floor(number/step + 0.5)*step
end

Here is the positioning:

ghost:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z)))

I don't get why it's happening?


Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
23 Aug 2017 07:27 AM
Is there any other code? I doubt this is to blame :/ Unless of course if the primary part of the model was offset to one side which could cause the whole model to be offset, which would in turn move the ghost part inside the existing part.


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 07:47 AM
script.Parent.test.MouseButton1Click:connect(function()
local placed
local mouse = player:GetMouse()
local ghost = game.ReplicatedStorage.Block:Clone()
for _,v in ipairs(ghost:GetChildren()) do
v.Transparency = v.Name ~= "Main" and .5 or 1
end
ghost.Parent = workspace.ignore
mouse.TargetFilter = workspace.ignore
moving = true
local con
con = mouse.Button1Down:connect(function()
placed = true
moving = false
end)

while moving do
wait()
local Surface = mouse.TargetSurface
print(Surface)
ghost:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z)))
end
con:disconnect()
if placed then
local block = game.ReplicatedStorage.Block:Clone()
block.Parent = workspace
block:SetPrimaryPartCFrame(CFrame.new(round(4,mouse.Hit.X),round(4,mouse.Hit.Y) + 2,round(4,mouse.Hit.Z)))
ghost:Destroy()
end
end)


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 08:51 AM
bump, idk why its not working


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 09:38 AM
bump


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 10:43 AM
bump


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 11:29 AM
bump


Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
23 Aug 2017 11:40 AM
try this: return math.floor(number/step + 0.5)*number


Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
23 Aug 2017 12:38 PM
Nope didn't work. That makes the block not even appear.


Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
23 Aug 2017 02:02 PM
Judging by the GIF I assume there is only 1 part to move?


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image