Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script gives false CFrame to model (answered) ?

I'm making a c4 and I want it to stick to walls if the player is in a zone nearby the wall

so

i made a script for it but now it always goes to the middel of the map here is my script

script.Parent.Thouchpart.Touched:connect(function(hit)
	if hit.Name == "sticktowall" then
		local model = Instance.new("Model")
		model.Parent = game.Workspace
		script.Parent.Parent = model
		model.PrimaryPart = script.Parent.Thouchpart
		local value = hit.Parent.Center.Position
		script.Value.Value = value
		print(script.Value.Value)
		local cfr = model:GetPrimaryPartCFrame()
		wait()
		model:SetPrimaryPartCFrame(CFrame.new(Vector3.new(script.Value.Value)))
		cfr = model:GetPrimaryPartCFrame()
		print(cfr)
		print(model:GetPrimaryPartCFrame())
		script.Parent.Parent = game.Workspace
		model:Destroy()

1 answer

also just simple

just take the "Vector3.new" and 1 "()" out at line 12 then it will work

This discussion is preserved as it was. New answers, comments, and votes are closed.