Hello everyone, I'm creating a spawn car, when they click on a button, they generate a car and erase the old ones but it don´t work can help me please i Need this
normal script Located in a part on Workspace it´s a BillboardGui
01 | script.Parent.MouseButton 1 Click:connect( function (GetCar) |
02 | local plyr = game.Players.LocalPlayer |
03 | Mod = game.ServerStorage.DodgeChallenger |
04 | clone = Mod:clone() |
05 | clone.Parent = workspace |
06 | clone:MakeJoints() |
07 | if game.Workspace.DodgeChallenger.CurrentOwner.Value = = plyr.Name then |
08 | clone:Destroy() |
09 | end |
10 | clone.CurrentOwner.Value = plyr.Name |
11 |
12 | end ) |
please help me with this code i need it
01 | local m = game:GetService( "ServerStorage" ).DodgeChallenger |
02 | local click = script.Parent |
03 |
04 | click.MouseClick:connect( function (p) |
05 | local player = game.Players [ p.Name ] |
06 | if player then |
07 | local owner = workspace:FindFirstChild(player.Name.. "'s DodgeChallenger" ) |
08 | if owner then |
09 | owner:Destroy() |
10 | end |
11 | local clone = m:Clone() |
12 | clone.Parent = workspace |
13 | clone:MakeJoints() |
14 | clone.Name = player.Name.. "'s DodgeChallenger" |
15 | end |
16 | end ) |
Instead of using a value, just rename the model, then it will be easy to find the owner This script should work now, just put the script inside a ClickDetector and its finished