I have made a bullethole using SurfaceGUI and ImageLabel and I’m wondering how I could crop the part of the texture that isn’t on the wall.
SurGUI CanvasSize = 500, 500
ImgLabel Size = 500, 500
I have made a bullethole using SurfaceGUI and ImageLabel and I’m wondering how I could crop the part of the texture that isn’t on the wall.
SurGUI CanvasSize = 500, 500
ImgLabel Size = 500, 500
When changing an image, isnt there a Property to change how it fills the GFrame?
I don’t think so.
I’ve looked into ImageRectSize and Offset but it doesn’t seem to be working for me.
Wouldn’t it just be
ImgLabel.Size = Udim2.new(0.5,0,0.5,0)
Create a Frame inside your SurfaceGUI, set Frame’s ClipsDescendants
property to false, and place every hole into this Frame, this should fix your issue.
Thanks. Now I just need to figure out how I can detect if its over the wall
If you’re asking if it’s outside the bounds of the wall, it’s simple.
local frameSize = hole.Parent.AbsoluteSize
local holeSize = hole.AbsoluteSize
local pos = hole.AbsolutePosition
if pos.X < 0 or pos.Y < 0 or pos.X + holeSize.X > frameSize.X or pos.Y + holeSize.Y > frameSize.Y then
-- At least one corner of the hole is outside the frame bounds
end
Sorry for the late reply but I can’t seem to figure out how to implement this on my script.
Can you help?
Evt.HitEffect.OnServerEvent:Connect(function(Player, Position, HitPart, Normal, Material, Settings)
Evt.HitEffect:FireAllClients(Player, Position, HitPart, Normal, Material, Settings)
local gun = Player.Character:FindFirstChildWhichIsA("Tool")
if HitPart.Material == Enum.Material.Concrete or HitPart.Material == Enum.Material.Cobblestone or HitPart.Material == Enum.Material.Pebble or HitPart.Material == Enum.Material.Fabric then
local a = script.HolePart:Clone()
a.FormFactor = "Custom"
a.CFrame = CFrame.new(Position,Position-Normal) * CFrame.Angles(90*math.pi/180,math.random(0,360)*math.pi/180,0)
a.BrickColor = BrickColor.new("Really black")
a.Material = Enum.Material.Air
local b = Instance.new('WeldConstraint')
b.Parent = a
b.Part0 = a
b.Part1 = HitPart
local c = a.SurfaceGui.Frame.ImageLabel
c.Image = "rbxassetid://"..concrete_bulletholes[math.random(1,5)]
local e = Instance.new("Weld")
e.Part0 = a
e.Part1 = HitPart
a.Parent = HitPart
end
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.