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

Script doesn't work on published version only at studio?

This script is inside a textbutton , it works on studio but on published version it's not.


local mouse = game.Players.LocalPlayer:GetMouse()
local ply = game.Players.LocalPlayer.Name
a = game.ReplicatedStorage.TestModel:clone()


script.Parent.MouseButton1Click:connect(function()

	a.Parent = game.Workspace
	a:MakeJoints()
	mouse.TargetFilter = a


	a:MoveTo(Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y + (a:GetExtentsSize().Y / 2), mouse.Hit.p.Z))
	a:MoveTo(Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y, mouse.Hit.p.Z))
	target = game.Players.LocalPlayer:GetMouse().Hit

	game.Workspace.TestModel.plyName.Value = ply
	print("cloned")
end)



Developer console log http://i.imgur.com/vQ30xiC.jpg

2 comments

0

clone is only called once, you need to place it inside the event with the function.

0

It has to be localscript.

1 answer

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