I was working on a script for a dinosaur morph gui button and the script doesnt work. any errors? The gui works fine but the button does nothing when i click it. The button has this script 1st and the model second as its children. Does the order matter?
Trex=script.Parent Trex01=Trex.Parent:findFirstChild("Trex01") clone=Trex01:clone()
function Clicked(click) if click.Parent == nil then return end newClone = clone:Clone() newClone.Parent = workspace newClone:MakeJoints() game.Players[click.Parent.name].Character = newClone end
button.MouseButton1Down:connect(click)
Trex is the button and Trex01 is the morph model
Im a noob scripter so plz dont get mad :D its proly a small stupid error anyway.
Place Trex01 in Lighting
Trex01 must be a model
Trex01 must have a Humanoid and a Head.
For the rest I can don't answer you sorry, but the script have to work
local player = game.Players.LocalPlayer local button = script.Parent.button local Trex01 = game.Lighting:FindFirstChild("Trex01") local clone = Trex01:clone() function Clicked() local newClone = clone:Clone() newClone.Parent = workspace newClone:MakeJoints() player.Character = newClone workspace.CurrentCamera.CameraSubject = player.Character.Humanoid end button.MouseButton1Down:connect(Clicked)
put in LocalScript