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

Can anybody help me with having a tool make a wall appear?

So I've been trying for an hour or two to try and make a wall appear 5 studs away from the player when they press X, but I'm getting this error "ServerScriptService.sheet:7: attempt to call a CFrame value" and I'm not sure what to do. I also tried making it so it would pop up out of the ground but I couldn't figure that out either so I decided not to. Here's the code

local sheet = game.ServerStorage:WaitForChild("sheet")

game.ReplicatedStorage.Sheet.OnServerEvent:Connect(function(player, CFrame)
	local character = player.Character
	local newSkill = sheet:Clone()
	local offsetCFrame = Instance.new("CFrameValue")
	offsetCFrame.CFrame = CFrame(5, 0, 0)
	newSkill.CFrame = character.HumanoidRootPart.CFrame:ToWorldSpace(offsetCFrame)
	newSkill.CanCollide = true
	local skillHit
	skillHit = newSkill.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Part") then
			hit.Parent.Part:Destroy()
		end
	end)
end)

1 answer

offsetCFrame.CFrame = CFrame(5, 0, 0)

You are calling a CFrame value, CFrame is a table which means it has some functions inside of it... hmm let me see, you used CFrame:ToWorldSpace which is a function inside of the CFrame so there must be function for line 7... CFrame.new().

offsetCFrame.CFrame = CFrame.new(5, 0, 0)

This creates new CFrame based off of given properties

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