script.Parent.Parent.Parent.Parent.Information.Spawnbutton.MouseButton1Click:Connect(function()
if plr:GetRankInGroup(script.Parent.GroepID.Value) > script.Parent.GroepRank.Value then
if not game.Workspace:FindFirstChild(plr.Name.."'s Car") then
local Copy = SSS:FindFirstChild(script.Parent.AutoSpawn.Value)
local Clone = Copy:Clone()
Clone.Name = plr.Name.."'s Car"
Clone.Parent = workspace
end
else
plr:Kick("Anti Exploit")
end
end)
This script is for a Spawn Script for a car, the value have the good name value.
here my error:
Players.IndexSearchx.PlayerGui.EenhedenSpawn.MainFrame.ScrollingFrame.basic.Script:23: attempt to index nil with 'Clone
SSS:FindFirstChild(script.Parent.AutoSpawn.Value) cannot be found. Try printing out script.Parent.AutoSpawn.Value and see if it exists in SSS. If you could attach a screenshot of the explorer too that would be helpful.
If SSS is ServerScriptStorage then make sure this isn’t a LocalScript since clients cannot see anything in ServerScriptStorage.
Yeah thats working now, can u help me with a other problem?
I have now a problem that its spawns but if i click on the other vehicle it spawns the same one. Here some pictures/scripts.
local Settings = require(script.Parent.Parent.Parent.Parent.Settings)
local Informatie = script.Parent.Parent.Parent.Parent.Information
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
local SSS = game:GetService("ServerStorage")
script.Parent.Parent.Parent.Parent.Information.Spawnbutton.MouseButton1Click:Connect(function()
if plr:GetRankInGroup(script.Parent.GroepID.Value) > script.Parent.GroepRank.Value then
if not game.Workspace:FindFirstChild(plr.Name.."'s Car") then
local Clone = SSS:FindFirstChild(script.Parent.AutoSpawn.Value):Clone()
Clone.Name = plr.Name.."'s Car"
Clone.Parent = workspace
plr.PlayerGui.EenhedenSpawn:Destroy()
else
game.Workspace:FindFirstChild(plr.Name.."'s Car"):Destroy()
local Copy = SSS:FindFirstChild(script.Parent.AutoSpawn.Value)
local Clone = Copy:Clone()
Clone.Name = plr.Name.."'s Car"
Clone.Parent = workspace
plr.PlayerGui.EenhedenSpawn:Destroy()
end
end
end)
As in it spawns the same car as the one you clicked on, or the one you originally had? By the looks of it you’re using whatever value the AutoSpawn is returning, how are updating that?
Okay I’m understanding the cloning part and putting them into ScrollingFrame, how are you detecting the button clicks of the “basic” TextButton that you’re cloning?
I’m noticing once you hit Spawnbutton it’s just pulling from whatever script.Parent.AutoSpawn.Value is,
Can you try something slightly different? Under the “Information” Frame, make a StringValue called CarName and have the value to whatever you was as default, if they click any of the cloned frames for each car, make it change the CarName Value to that car, and then read that value when they press Spawnbutton?
Or lay it how you want, but maybe try it this way, I’m just slightly confused on how exactly you’re detecting the car that they pick.
P.S: You can change script.Parent.Parent.Parent.Parent.Information.Spawnbutton to Informatie.Spawnbutton